clickhouse 多数据源

application.properties

server.port=8181
spring.application.name=EC_CustomerComplaint_Backend

#clickhouse的配置
spring.datasource.driver-class-name=ru.yandex.clickhouse.ClickHouseDriver
spring.datasource.url=jdbc:clickhouse://10.0.12.14:8213?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
spring.datasource.username=default
spring.datasource.password=eb22d98eaf028b1ca5c36548193d604a

spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=40
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=60000
spring.datasource.hikari.pool-name=ClickHouse Hikari DataSource
spring.datasource.hikari.max-lifetime=300000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=select 1

# Redis数据库索引(默认为0)
spring.redis.database=0
# Redis服务器地址
spring.redis.host=10.0.12.14
# Redis服务器连接端口
spring.redis.port=16379
# Redis服务器连接密码(默认为空)
spring.redis.password=yunzhihui123
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.jedis.pool.max-active=20
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=10
# 连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=0
# 连接超时时间(毫秒)
spring.redis.timeout=1000
spring.redis.resultCdMap=ec:complaint:resultCdMap
spring.redis.hostnameMap=ec:complaint:hostnameMap
spring.redis.factorMap=ec:complaint:factorMap
spring.redis.listMarketingActivityLog.ttl=30
#二级缓存的超时时间 15天
spring.redis.stringMarketingActivityLogToSc.ttl=10
spring.redis.map.ttl=86400

# 客诉新版日志动态sql表头
kesu.sql.filed.marketingActivityLog=transDt,cardNo,orderAt,discountId,activityNm,resultCd,factor,factorName,logId,mobile,userId,mchntCd,hostname,message

# 客诉老版日志动态sql表头
kesu.sql.filed.listLogMessage=hostname,logTime,message

# 新版客诉数据表
kesu.sql.new.tableName=_cw_distributed_db.tbl_market_log_info_all

# 老版客诉数据表
kesu.sql.old.tableName=tmp.tbl_market_activity_log_info

# 客诉字典表
kesu.sql.resultcd.tableName=_cw_distributed_db.upsf_ods_upb_tbl_market_activity_dict_resultcd

kesu.sql.hostname.tableName=_cw_distributed_db.upsf_ods_upb_tbl_market_activity_dict_hostname

kesu.sql.factor.tableName=_cw_distributed_db.upsf_ods_upb_tbl_market_activity_dict_factor


#二级缓存保存条数阈值
kesu.second.cache.threshold=5000

#是否使用二级缓存
kesu.second.cache.isUse=true

 

nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  "pipe:rollback logs/error_log interval=1d baknum=7 maxsize=2G";

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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;
    #access_log  "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G"  main;

    sendfile        on;
    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' '$connection $upstream_addr ' 'upstream_response_time $upstream_response_time request_time $request_time ';


    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    upstream kesuServer {
    server 10.0.12.14:8181 weight=1;
    server 10.0.12.15:8181 weight=1;
    server 10.0.12.17:8181 weight=1;
    }
    upstream clickhouse{
    server 10.0.12.14:18123 weight=1  max_fails=3 fail_timeout=60s;
    server 10.0.12.15:18123 weight=1  max_fails=3 fail_timeout=60s;
    server 10.0.12.17:18123 weight=1  max_fails=3 fail_timeout=60s;
    }
    server {
        listen     8213;
    server_name localhost;
    access_log  logs/clickhouse.access.log  main;
    error_log logs/clockhouse.error.log error;
    location / {
           proxy_pass http://clickhouse;
        }
    }



    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        #access_log  "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G"  main;

        #location / {
         #   root   html;
          #  index  index.html index.htm;
       # }

        #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;
        }
    location ~ ^/kesu {
           rewrite /kesu/(.*) /$1 break;
       proxy_pass http://kesuServer;
    }
    location / {
       root /data/app/kesu/web/dist;
       index index.html index.htm index.php; 
       try_files $uri /index.html;
    }


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # pass the Dubbo rpc to Dubbo provider server listening on 127.0.0.1:20880
        #
        #location /dubbo {
        #    dubbo_pass_all_headers on;
        #    dubbo_pass_set args $args;
        #    dubbo_pass_set uri $uri;
        #    dubbo_pass_set method $request_method;
        #
        #    dubbo_pass org.apache.dubbo.samples.tengine.DemoService 0.0.0 tengineDubbo dubbo_backend;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # upstream for Dubbo rpc to Dubbo provider server listening on 127.0.0.1:20880
    #
    #upstream dubbo_backend {
    #    multi 1;
    #    server 127.0.0.1:20880;
    #}

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

 

上一篇:一文搞定clickhouse集群安装部署


下一篇:ES不香吗,为啥还要ClickHouse?