Orbit 命令行安装

Orbit 命令行安装#

  1. 安装Orbit前端微服务

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

    # 添加前端的端口转发配置
    # Orbit fe
    server {
        listen       2202;
        listen       [::]:2202;
        server_name  _;
    
        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/orbit-fe/dist;
            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';
        }
        location /orbit/ {
            alias /usr/local/oushu/orbit-fe/dist/;
            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端口的转发规则
     # Orbit
     location ~ ^/api/orbit(.*) {
     proxy_pass http://127.0.0.1:2201/orbit$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/Orbit/assets/(.*) {
     proxy_pass http://127.0.0.1:2202/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/Orbit/fonts(.*) {
     proxy_pass http://127.0.0.1:2202/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. 安装Orbit后端服务

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

    • 文件位置

    /usr/local/oushu/conf/orbit/jdbc.properties
    
    • 配置内容及注意事项

    jdbc.host=localhost
    jdbc.port=4432
    jdbc.database=orbit
    jdbc.schema=public
    jdbc.username=oushu
    jdbc.password={{此处须手动配置Skylab PG的强密码}}
    
  4. Orbit配置

    • 文件位置

    /usr/local/oushu/conf/orbit/application.properties
    
    • 配置内容及注意事项

    # The SQL dialect makes Hibernate generate better SQL for the chosen database
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    spring.jpa.properties.hibernate.session_factory.statement_inspector=io.oushu.javacommon.authorization.HibernateInterceptor
    # Hibernate ddl auto (create, create-drop, validate, update)
    spring.jpa.hibernate.ddl-auto=update
    spring.datasource.hikari.connection-timeout=30000
    spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
    spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
    # logging
    logging.file-location=/usr/local/oushu/log/orbit
    logging.level.root=INFO
    logging.level.io.oushu.orbit.core.controller=TRACE
    logging.level.io.oushu.orbit.core.common=DEBUG
    logging.level.org.hibernate.SQL=debug
    logging.level.org.hibernate.engine.QueryParameters=debug
    logging.level.org.hibernate.engine.query.HQLQueryPlan=debug
    logging.level.org.hibernate.type.descriptor.sql.BasicBinder=trace
    #No auth  protected
    endpoints.shutdown.sensitive=false
    #Enable shutdown endpoint
    endpoints.shutdown.enabled=true
    spring.servlet.multipart.enabled=true
    # Single file max size
    spring.servlet.multipart.max-file-size=5000000000
    # All files max size
    spring.servlet.multipart.max-request-size=10000000000
    spring.profiles.active=common
    server.servlet.context-path=/orbit
    server.port=2201
    orbit.config.path=/usr/local/oushu/conf/orbit
    # ES 
    elasticsearch.rest.hostNames=82.157.75.251:9200,82.157.170.200:9200,82.157.167.172:9200
    #x-pack or searchguard security authentication and password configuration
    # elasticUser=elastic
    # elasticPassword=changeme
    # ES index
    assets.es.index=assets_16ee8d87eb2b4e99a35e67e89e6740ca
    assets.es.max_len=256
    assets.es.search_cols=name, alias, comment   
    spring.jpa.show-sql=true
    spring.jpa.properties.hibernate.format_sql=false
    # Lava server
    basic.master.lava.ssl=false
    basic.master.lava.http.port=8080
    basic.master.lava.https.port=443
    basic.master.lava.host=localhost
    # Multi Thread
    total.thread.pool.size=16
    collect.thread.size=8
    
  5. orbit-env配置

    • 文件位置

    /usr/local/oushu/orbit/bin/orbit-env.sh
    
    • 配置内容及注意事项

    export JAVA_CMD=java
    export log_path=/usr/local/oushu/log/orbit
    export host=localhost
    export ssl=false
    export https_port=2201
    export http_port=2201
    export LD_LIBRARY_PATH=/usr/local/oushu/clib:$LD_LIBRARY_PATH
    export DYLD_LIBRARY_PATH=/usr/local/oushu/clib:$DYLD_LIBRARY_PATH
    
  6. Orbit 后端服务启停

    orbit start [-d]
    orbit stop
    orbit restart [-d]
    
  7. 注册Orbit集群

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

​ Orbit.json 文件如下

{
    "data": {
        "name": "Orbit集群1",
        "group_roles": [{
           "role": "orbit.master",
           "cluster_name": "orbit-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": "orbit.standby",
           "cluster_name": "orbit-4bee3d",
           "group_name": "standby-4bee3d",
           "machines": [] // standby 节点暂不需要配置machines
        }],
        "config": {
           "application.properties": [{
              "key": "spring.jpa.properties.hibernate.dialect",
              "value": "org.hibernate.dialect.PostgreSQLDialect"
           }, {
              "key": "spring.jpa.properties.hibernate.session_factory.statement_inspector",
              "value": "io.oushu.javacommon.authorization.HibernateInterceptor"
           }, {
              "key": "spring.jpa.hibernate.ddl-auto",
              "value": "update"
           }, {
              "key": "spring.datasource.hikari.connection-timeout",
              "value": "30000"
           }, {
              "key": "spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation",
              "value": "true"
           }, {
              "key": "spring.jpa.properties.hibernate.enable_lazy_load_no_trans",
              "value": "true"
           }, {//配置orbit log path
              "key": "logging.file-location",
              "value": "/usr/local/oushu/log/orbit"
           }, {
              "key": "logging.level.root",
              "value": "INFO"
           }, {
              "key": "logging.level.io.oushu.orbit.core.controller",
              "value": "TRACE"
           }, {
              "key": "logging.level.io.oushu.orbit.core.common",
              "value": "DEBUG"
           }, {
              "key": "logging.level.org.hibernate.SQL",
              "value": "debug"
           }, {
              "key": "logging.level.org.hibernate.engine.QueryParameters",
              "value": "debug"
           }, {
              "key": "logging.level.org.hibernate.engine.query.HQLQueryPlan",
              "value": "debug"
           }, {
              "key": "logging.level.org.hibernate.type.descriptor.sql.BasicBinder",
              "value": "trace"
           }, {
              "key": "endpoints.shutdown.sensitive",
              "value": "false"
           }, {
              "key": "endpoints.shutdown.enabled",
              "value": "true"
           }, {
              "key": "spring.servlet.multipart.enabled",
              "value": "true"
           }, {
              "key": "spring.servlet.multipart.max-file-size",
              "value": "5000000000"
           }, {
              "key": "spring.servlet.multipart.max-request-size",
              "value": "10000000000"
           }, {
              "key": "spring.profiles.active",
              "value": "common"
           }, {
              "key": "server.servlet.context-path",
              "value": "/orbit"
           }, {//配置orbit port 
              "key": "server.port",
              "value": "2201"
           }, {
              "key": "orbit.config.path",
              "value": "/usr/local/oushu/conf/orbit"
           }, {//配置es集群
              "key": "elasticsearch.rest.hostNames",
              "value": ".157.75.251:9200,82.157.170.200:9200,82.157.167.172:9200"
           }, {
              "key": "assets.es.index",
              "value": "assets_16ee8d87eb2b4e99a35e67e89e6740ca"
           }, {
              "key": "assets.es.max_len",
              "value": "256"
           }, {
              "key": "assets.es.search_cols",
              "value": "name, alias, comment"
           }, {
              "key": "spring.jpa.show-sql",
              "value": "true"
           }, {
              "key": "spring.jpa.properties.hibernate.format_sql",
              "value": "false"
           }, {//配置lava ssl
              "key": "basic.master.lava.ssl",
              "value": "false"
           }, {//配置lava port
              "key": "basic.master.lava.http.port",
              "value": "8080"
           }, {//配置lava port
              "key": "basic.master.lava.https.port",
              "value": "443"
           }, {//配置lava host
              "key": "basic.master.lava.host",
              "value": "localhost"
           }, {//配置orbit线程池线程数
              "key": "total.thread.pool.size",
              "value": "10"
           }, {//配置采集任务线程数
              "key": "collect.thread.size",
              "value": "8"
           }],//配置orbit 数据库连接信息
           "jdbc.properties": [{
              "key": "jdbc.host",
              "value": "localhost"
           }, {
              "key": "jdbc.port",
              "value": "4432"
           }, {
              "key": "jdbc.database",
              "value": "orbit"
           }, {
              "key": "jdbc.schema",
              "value": "public"
           }, {
              "key": "jdbc.username",
              "value": "oushu"
           }, {
              "key": "jdbc.password",
              "value": "Oushu6@China"
           }],
           "orbit-env.sh": [{
              "key": "JAVA_CMD",
              "value": "java"
           }, {//配置orbit log,需要与application.properties一致
              "key": "log_path",
              "value": "/usr/local/oushu/log/orbit"
           }, {//配置orbit host
              "key": "host",
              "value": "localhost"
           }, {//配置orbit ssl
              "key": "ssl",
              "value": "false"
           }, {//配置orbit port 需要与application.properties一致
              "key": "https_port",
              "value": "2201"
           }, {//配置orbit port 需要与application.properties一致
              "key": "http_port",
              "value": "2201"
           }, {
              "key": "LD_LIBRARY_PATH",
              "value": "/usr/local/oushu/clib:$LD_LIBRARY_PATH"
           }, {
              "key": "DYLD_LIBRARY_PATH",
              "value": "/usr/local/oushu/clib:$DYLD_LIBRARY_PATH"
           }]
        }
}