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

快速安装说明

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

Step 2:检出代码。

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

Step 3:先决条件:

你必须先安装play或者activator命令行。下载activatorzip包https://downloads.typesafe.com/typesafe-activator/1.3.12/typesafe-activator-1.3.12.zip ,解压并添加activator命令到你自己的环境变量$PATH。对于老版的play,你需要添加paly命令并替换activator
12
export ACTIVATOR_HOME=/path/to/unzipped/activatorexport PATH=$ACTIVATOR_HOME/bin:$PATH
Dr.Elephant将分析数据结果存储在MySQL数据中。如果你还没装,请先安装好MySQL。(推荐5.5以上版本)

为了正常使用Dr. ElephantUI界面,需要安装npm及其依赖

123
sudo yum install npmsudo npm install -g bowercd 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包:

123456789
  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目录下。

12
$> ls distdr-elephant*.zip

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

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

1234
$> 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数据库的相关连接信息。

12345
# Database configurationdb_url=localhostdb_name=drelephantdb_user=rootdb_password=""

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

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

12
$> vim ./app-conf/elephant.confjvm_props=" -Devolutionplugin=enabled -DapplyEvolutions.default=true"

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

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

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

123456
$> less $DR_RELEASE/dr.log...play - database [default] connected at jdbc:mysql://localhost/drelephant?characterEncoding=UTF-8application - 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

文章来源:

Author:hyperxu
link:http://www.hyperxu.com/2018/11/05/dr-elephant-3/