Kepler 命令行安装

Kepler 命令行安装#

  1. 安装Kepler前端微服务

    yum install -y kepler-fe
    # 注意此项需要安装在前端Nginx服务器对应的节点上
    
    • 安装后,需要在Nginx的配置文件中加入相关配置并reload Nginx(正常的话已经有了,如果有就不用添加和reload了)

    # 添加前端的端口转发配置
    # Kepler
    server {
       listen       3011;
       server_name  localhost;
    
       gzip_static on;
    
       error_page  404              /404.html;
       # redirect server error pages to the static page /50x.html
       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
          root   html;
       }
    
       # common router
       location / {
          root /usr/local/oushu/kepler-fe;
          try_files $uri $uri/ /index.html;
          index index.html;
          add_header Cache-Control no-cache;
          add_header Access-Control-Allow-Origin *;
          add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
          add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
       }
    }
    
    # 添加3000端口的转发规则
    # kepler
    location ~ ^/api/lava/kepler(.*) {
       proxy_pass http://127.0.0.1:17877/lava/kepler$1$is_args$args;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_ignore_client_abort   on;
    }
    location ~ ^/main/Kepler/assets(.*) {
       proxy_pass http://127.0.0.1:3011/assets$1$is_args$args;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location ~ ^/main/Kepler/fonts(.*) {
       proxy_pass http://127.0.0.1:3011/assets/css/fonts$1$is_args$args;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    
  2. 安装Kepler后端服务

    yum install -y kepler
    
  3. 数据库配置

    • 文件位置

    /usr/local/oushu/kepler/conf/postgres.config.xml
    
    • 配置内容及注意事项

    <?xml version="1.0" encoding="utf-8"?>
    <!--
    ~ Copyright (c) 2018. Oushu
    -->
    <postgres>
       <host>localhost</host>
       <port>4432</port>
       <user>oushu</user>
       <password>{{此处须手动配置Skylab PG的强密码}}</password>
       <dbname>kepler</dbname>
       <sslmode>disable</sslmode>
       <utuser>unittest</utuser>
       <utpassword>0ushuCloud</utpassword>
    </postgres>
    
  4. Kepler配置

    • 文件位置

    /usr/local/oushu/kepler/conf/kepler-site.xml
    
    • 配置内容及注意事项

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
       <property>
          <name>basic.storage</name>
          <value>/tmp/kepler</value>
          <description>Kepler temporary storage dirctory</description>
       </property>
       <property>
          <name>basic.master.log.path</name>
          <value>/usr/local/oushu/log/kepler/</value>
          <description>Kepler log dirctory</description>
       </property>
    
       <!-- START: new lava host config -->
       <property>
          <name>basic.master.lava.protocol</name>
          <value>https</value>
          <description>lava 服务协议</description>
       </property>
       <property>
          <name>basic.master.lava.host</name>
          <value>localhost</value>
          <description>lava 服务ip</description>
       </property>
       <property>
          <name>basic.master.lava.port</name>
          <value>443</value>
          <description>lava 服务端口</description>
       </property>
       <!-- END: new lava host config -->
    
       <property>
          <name>basic.master.kepler</name>
          <value>http://localhost:17877</value>
          <description>Kepler server URL</description>
       </property>
       <property>
          <name>basic.bi.host</name>
          <value>127.0.0.1</value>
          <description>BI server ip address(须配置为KEPLER的外网IP地址)</description>
          <!-- 在手动安装后需要配置为Kepler所在机器的外网地址,如果是内网环境则显式配置未可访问的内网地址 -->
          <!-- 禁止配置为127.0.0.1、0.0.0.0、localhost或主机hostname -->
       </property>
       <property>
          <name>basic.master.dataend</name>
          <value>https://localhost:1671</value>
          <description>Dataend service URL</description>
       </property>
       <property>
          <name>basic.master.port</name>
          <value>17877</value>
          <description>Kepler server port</description>
       </property>
    
    
       <!-- 以下为冗余配置,暂时不需要管 -->
       <property>
          <name>header.navbar.img</name>
          <value>assets/img/svg/logo.svg</value>
          <description>navbar的图片路径</description>
       </property>
       <property>
          <name>header.navbar.title</name>
          <value>对话式数据分析平台</value>
          <description>navbar的title</description>
       </property>
       <property>
          <name>header.browser.img</name>
          <value>/favicon.ico</value>
          <description>浏览器tab的ico</description>
       </property>
       <property>
          <name>header.browser.title</name>
          <value>Kepler 对话式数据分析平台</value>
          <description>浏览器tab的title</description>
       </property>
       <property>
          <name>header.custom.img.prefix</name>
          <value>/custom/test</value>
          <description>访问文件的前缀</description>
       </property>
       <property>
          <name>header.custom.img.path</name>
          <value>/tmp/img</value>
          <description>使用前缀为"header.custom.img.prefix"的请求将会访问该路径下的文件</description>
       </property>
    </configuration>
    
  5. Kepler 后端服务启停

    cd /usr/local/oushu/kepler
    ./kepler start master
    ./kepler stop master
    
  6. 注册Kepler集群

    sudo yum install -y lavam
    cd /usr/local/oushu/lavam/bin
    ./lavam deploy service addSelf -s Kepler -f Kepler.json
    

    Kepler.json 文件如下

    {
        "data": {
            "name": "Kepler集群1",
            "group_roles": [{
               "role": "kepler.master",
               "cluster_name": "kepler-4bee3d",
               "group_name": "master-4bee3d",
               // 要安装的机器信息,在lavaadmin的元数据表machine中能查到
               // master节点需要选择安装在skylab所在的机器,且只能有一台
               "machines": [{
                  "id": 2449, // skylab所在的机器的id
                  "name": "机器hostname",
                  "subnet": "lava",
                  "data_ip": "机器内网ip",
                  "manage_ip": "机器外网ip",
                  "assist_port": 1622,
                  "ssh_port": 22
               }]
            }, {
               "role": "kepler.standby",
               "cluster_name": "kepler-4bee3d",
               "group_name": "standby-4bee3d",
               "machines": [] // standby 节点暂不需要配置machines
            }],
            "config": { // 此中的配置需参考  **章节4. Kepler配置**
         		"kepler-site.xml": [{
         			"key": "basic.storage",
         			"value": "/tmp/kepler"
         		}, {
         			"key": "basic.master.log.path",
         			"value": "/usr/local/oushu/log/kepler/"
         		}, {
         			"key": "basic.bi.host",
         			"value": ""
         		}, {
         			"key": "basic.master.kepler",
         			"value": "http://10.0.196.206:17877"
         		}, {
         			"key": "basic.master.lava.protocol",
         			"value": "https"
         		}, {
         			"key": "basic.master.lava.host",
         			"value": "10.0.196.97"
         		}, {
         			"key": "basic.master.lava.port",
         			"value": "443"
         		}, {
         			"key": "basic.master.dataend",
         			"value": "https://localhost:1671"
         		}, {
         			"key": "basic.master.port",
         			"value": "17877"
         		}, {
         			"key": "header.navbar.img",
         			"value": "assets/img/svg/logo.svg"
         		}, {
         			"key": "header.navbar.title",
         			"value": "对话式数据分析平台"
         		}, {
         			"key": "header.browser.img",
         			"value": "/favicon.ico"
         		}, {
         			"key": "header.browser.title",
         			"value": "Kepler 对话式数据分析平台"
         		}, {
         			"key": "header.custom.img.prefix",
         			"value": "/custom/test"
         		}, {
         			"key": "header.custom.img.path",
         			"value": "/tmp/img"
         		}],
         		"postgres.config.xml": [{
         			"key": "postgres.dbname",
         			"value": "kepler"
         		}]
         	}
    }