【Dr.Elephant中文文档-3】快速安装说明

快速安装说明

Step 1:在GitHub上注册一个账号,并fork一份Dr. Elephant项目代码。

Step 2:检出代码。

1
2
$> git clone https://github.com/<username>/dr-elephant
$> cd dr-elephant*

Step 3:先决条件:

1
2
export ACTIVATOR_HOME=/path/to/unzipped/activator
export PATH=$ACTIVATOR_HOME/bin:$PATH
  • Dr.Elephant将分析数据结果存储在MySQL数据中。如果你还没装,请先安装好MySQL。(推荐5.5以上版本)
  • 为了正常使用Dr. ElephantUI界面,需要安装npm及其依赖

    1
    2
    3
    sudo yum install npm
    sudo npm install -g bower
    cd web; bower install; cd ..
  • 最后,你还需要安装好Hadoop或者Spark。

Step 4:(可选,Beta阶段)如果你想尝试自动优化的新功能,请按照以下步骤来操作。(更多详情:https://github.com/linkedin/dr-elephant/wiki/Auto-Tuning

  • 修改app-conf/AutoTuningConf.xmlautotuning.enabled的选项为true来启用自动优化功能
  • 安装python2.6以上的版本
  • 如果你想使用自定义安装的python版本:

    • PYTHON_PATH设置为所需要的python版本的可执行文件路径即可:

      1
      $> export PYTHON_PATH=/path/to/python/executable
    • 或者注释app-conf/AutoTuningConf.xml配置文件中的python.path选项。

  • 安装inspyred包:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    sudo pip install inspyred
    ```
    * 如果pip安装失败,可以从https://pip.pypa.io/en/stable/installing/ 处安装。
    **Step 5:**编译`Dr. Elephant`代码并打包生产`zip`包。`Compile.sh`脚本可以带一个配置文件路径参数,其中包含要编译的Hadoop和Spark的版本信息。具体信息请参阅开发者指南。
    ``` bash
    $> ./compile.sh [./compile.conf]

编译完成后,打包文件在dist目录下。

1
2
$> ls dist
dr-elephant*.zip

Step 6:复制打包后的程序到你打算安装Dr. Elephant的服务器上。

Step 7:在你安装Dr. Elephant的服务器上,确认以下环境变量配置好了。

1
2
3
4
$> export HADOOP_HOME=/path/to/hadoop/home
$> export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
$> export SPARK_HOME=/path/to/spark/home
$> export SPARK_CONF_DIR=/path/to/conf

Step 8:你同样需要一个存储数据的后端数据库。在elephant.conf配置文件中配置MySQL数据库的相关连接信息。

1
2
3
4
5
# Database configuration
db_url=localhost
db_name=drelephant
db_user=root
db_password=""

Step 9:如果你的群集是kerberised,则更新keytab用户和elephant.conf文件中的keytab文件位置。

Step 10:如果你是第一次运行Dr. Elephant,你需要打开evolutions功能,为此,请在elephant.conf配置文件中添加(或取消注释),-Devolutionplugin=enabled-DapplyEvolutions.default=true。这将会让Dr. Elephant自动创建相关的MySQL表,下次重启程序时记得关闭这个选项。

1
2
$> vim ./app-conf/elephant.conf
jvm_props=" -Devolutionplugin=enabled -DapplyEvolutions.default=true"

Step 11:要启动Dr. Elephant,需要在运行启动脚本时指定配置文件目录。

1
$> /bin/start.sh /path/to/app-conf/directory

要验证Dr. Elephant是否启动成功,请检查dr.log文件。

1
2
3
4
5
6
$> less $DR_RELEASE/dr.log
...
play - database [default] connected at jdbc:mysql://localhost/drelephant?characterEncoding=UTF-8
application - Starting Application...
play - Application started (Prod)
play - Listening for HTTP on /0:0:0:0:0:0:0:0:8080

要分析Dr. Elephant是否正确的分析作业,请检查dr.log文件。

1
$> less $DR_RELEASE/../logs/elephant/dr_elephant.log

Step 12:一旦应用启动,你可以打开ip:port (localhost:8080),查看UI界面。

Step 13:要停止应用,只需执行

1
$> bin/stop.sh
hyperxu wechat
欢迎您扫一扫上面的二维码,订阅我的公众号!
坚持原创技术分享,您的支持将鼓励我继续创作!