配置说明

Broker 配置

Broker服务主要有三类配置,Spring Boot进程配置、区块链FISCO-BCOS节点配置、WeEvent服务配置。

  • Spring Boot进程配置

    配置文件./broker/conf/application-prod.properties,这个是Spring Boot标准配置文件,一般不需要修改。细节请参见Spring Boot文档

配置项 默认值 配置说明
server.port 8081 spring监听端口
server.servlet.context-path /weevent spring上下文路径
  • 区块链FISCO-BCOS节点配置

    配置文件./broker/conf/fisco.properties

配置项 默认值 配置说明
version 2.0 FISCO-BCOS版本,支持2.0和1.3
topic-controller.address 1:0x23df89a2893120f686a4aa03b41acf6836d11e5d; WeEvent系统合约地址。
orgid fisco 机构名,按机构实际名称填写即可
nodes 127.0.0.1:30701 区块链节点列表,多个地址以;分割
account bcec428d5205abe0f0cc8a734083908d9eb8563e31f943d760786edf42ad67dd WeEvent执行交易的账号,一般不需要修改
web3sdk.timeout 10000 交易执行超时时间,单位毫秒
web3sdk.core-pool-size 10 web3sdk最小线程数
web3sdk.max-pool-size 200 web3sdk最大线程数
web3sdk.queue-capacity 1000 web3sdk队列大小
web3sdk.keep-alive-seconds 60 web3sdk线程空闲时间,单位秒

区块链节点详细配置,参见Web3SDK配置文件

  • WeEvent服务配置

    配置文件./broker/conf/weevent.properties

配置项 默认值 配置说明
consumer.idle-time 1000 消费者线程中检测区块链新增块事件的周期,单位毫秒
ip.check.white-table IP白名单。默认为空时表示允许任何客户端访问。多个IP地址,以";"进行分割
redis.server.ip redis服务IP
redis.server.port 6379 redis服务端口
redis.server.password weevent redis服务访问密码
lru.cache.capacity 65536 缓存大小,使用LRU策略淘汰
restful.subscribe.callback.timeout 5000 事件通知回调的超时时间,单位毫秒
broker.zookeeper.ip zookeeper服务
broker.zookeeper.path /event_broker zookeeper数据路径
broker.zookeeper.timeout 3000 zookeeper链接超时时间,单位秒
stomp.user.login stomp访问账号,空为不开启校验
stomp.user.passcode stomp访问密码
stomp.heartbeats 30 stomp心跳间隔,单位秒
mqtt.broker.port 8091 mqtt协议TCP访问端口
mqtt.broker.keepalive 60 mqtt连接空闲时间,单位秒
mqtt.websocket.path /weevent/mqtt mqtt连接目录
mqtt.websocket.port 8092 mqtt协议web socket访问端口
mqtt.user.login mqtt访问账号,空为不开启校验
mqtt.user.passcode mqtt访问密码

Governance

配置文件./governance/conf/application-prod.yml

配置项 默认值 配置说明
server.port 8082 spring监听端口
spring.datasource.url jdbc:mysql://127.0.0.1:3306/demo?useUnicode=true&characterEncoding=utf-8&useSSL=false 数据源
spring.datasource.driver-class-name org.mariadb.jdbc.Driver 驱动类
spring.datasource.username 数据库账号用户名
spring.datasource.password 数据库账号密码
spring.datasource.type
spring.datasource.dbcp2.max-wait-millis
spring.datasource.dbcp2.min-idle
spring.datasource.dbcp2.initial-size
spring.datasource.dbcp2.validation-query
spring.datasource.mail.default-encoding
spring.datasource.mail.host
spring.datasource.mail.username
spring.datasource.mail.password
spring.http.client.max-total 200
spring.http.client.max-per-route 500
spring.http.client.connection-request-timeout 3000
spring.http.client.connection-timeout 3000
spring.http.client.socket-timeout 5000
spring.https.client.read-timeout 5000
spring.https.client.connect-timeout 15000

Nginx 配置说明

  • 修改后端子模块路由

    通过配置文件nginx/conf/conf.d/http_rs.conf里的upstream来增加和移除后端的业务机器。

    upstream broker_backend{
        server localhost:8090 weight=100 max_fails=3;
    
        ip_hash;
        keepalive 1024;
    }
    
    upstream broker_mqtt_websocket_backend {
        server localhost:8092 weight=100 max_fails=3;
    
        ip_hash;
        keepalive 1024;
    }
    
    upstream governance_backend{
        server localhost:8099 weight=100 max_fails=3;
    
        ip_hash;
        keepalive 1024;
    }
    

    特别的,如果使用了基于TCPMQTT协议。配置文件为nginx/conf/conf.d/tcp_rs.conf

  • 使用TLS加密传输

    WeEvent通过Nginx实现TLS加密传输。在nginx/conf/nginx.conf文件里,通过include不同的文件来选择是否支持TSL

    如下面默认配置,不支持TLS。开启方式为对应行改为include ./conf.d/https.confinclude ./conf.d/tcp_tls.conf

    ########################################################################################################################
    # This is nginx configuration for WeEvent's proxy access.
    # 1. Support tcp access in default.
    #   like web/restful/jsonrpc over http, stomp over websocket, and mqtt over tcp or websocket.
    # 2. For security access
    #   a. support web/restful/jsonrpc over https, stomp over wss, and mqtt over wss
    #       replace default include line to "include ./conf.d/https.conf"
    #   b. support mqtt over tls
    #       replace default include line to "include ./conf.d/tcp_tls.conf"
    ########################################################################################################################
    
    #user  nobody;
    worker_processes  10;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    pid         logs/nginx.pid;
    
    events {
        use epoll;
        worker_connections  10000;
    }
    worker_rlimit_nofile 10000;
    
    #support web/restful/jsonrpc/stomp
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
    
        #custom config
        server_tokens           off;
        client_body_temp_path   ./nginx_temp/client_body;
        proxy_temp_path         ./nginx_temp/proxy;
        fastcgi_temp_path       ./nginx_temp/fastcgi;
        uwsgi_temp_path         ./nginx_temp/uwsgi;
        scgi_temp_path          ./nginx_temp/scgi;
    
        # http conf
        include                 ./conf.d/http_rs.conf;
    
        include                 ./conf.d/http.conf;
    }
    
    #support mqtt over tcp
    stream {
        include                 ./conf.d/tcp_rs.conf;
    
        include                 ./conf.d/tcp.conf;
    }
    

    更多Nginx配置文件说明,请参见Nginx配置