覆盖配置
# Global settings #--------------------------------------------------------------------- global # to have these messages end up in /var/log/haproxy.log you will # need to: # # 1) configure syslog to accept network log events. This is done # by adding the '-r' option to the SYSLOGD_OPTIONS in # /etc/sysconfig/syslog # # 2) configure local2 events to go to the /var/log/haproxy.log # file. A line like the following can be added to # /etc/sysconfig/syslog # # local2.* /var/log/haproxy.log # log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon # turn on stats unix socket stats socket /var/lib/haproxy/stats #--------------------------------------------------------------------- # common defaults that all the 'listen' and 'backend' sections will # use if not designated in their block #--------------------------------------------------------------------- defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 #--------------------------------------------------------------------- # main frontend which proxys to the backends #--------------------------------------------------------------------- ###############RabbitMQ服务################# listen rabbitmq_cluster bind 0.0.0.0:5672 mode tcp balance roundrobin server server-a 192.168.88.138:5672 check inter 5000 rise 2 fall 3 weight 1 server server-c 192.168.88.139:5672 check inter 5000 rise 2 fall 3 weight 1 ###############RabbitMQ管理界面################# listen rabbitmq_ui bind 0.0.0.0:15672 server server-a 192.168.88.138:15672 server server-c 192.168.88.139:15672 开放端口 firewall-cmd --permanent --add-port=15672/tcp firewall-cmd --permanent --add-port=5672/tcp firewall-cmd --reload
Kafka单节点部署
Zookeeper部署
下载Zookeeper并启动
docker run -d --restart always --name zookeeper -p 2181:2181 -v /root/zookeeper/data:/data -v /root/zookeeper/conf:/conf -v /root/zookeeper/logs:/logs zookeeper:3.6.1 开放2181端口 firewall-cmd --permanent --add-port=2181/tcp firewall-cmd --reload
Kafka服务部署
下载kafka 镜像并启动
docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=1 -e KAFKA_ZOOKEEPER_CONNECT=192.168.88.139:2181 -e KAFKA_ADVERTISED_HOST_NAME=192.168.88.141 -e KAFKA_ADVERTISED_PORT=9092 wurstmeister/kafka:2.12-2.5.0 创建目录并拷贝 mkdir /root/kafka docker cp kafka:/opt/kafka/config /root/kafka/config 删除原有的容器并重新创建 docker stop kafka docker rm kafka docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=1 -e KAFKA_ZOOKEEPER_CONNECT=192.168.88.139:2181 -e KAFKA_ADVERTISED_HOST_NAME=192.168.88.141 -e KAFKA_ADVERTISED_PORT=9092 -v /root/kafka/config: /opt/kafka/config wurstmeister/kafka:2.12-2.5.0 开放9092端口 firewall-cmd --permanent --add-port=9092/tcp firewall-cmd --reload
Kafka-eagle
下载jdk依赖
yum -y install java-1.8.0-openjdk*
下载kafka-eagle-bin包
wget -o kafka-eagle-bin.tar.gz https://codeload.github.com/smartloli/kafka-eagle-bin/tar.gz/v2.0.1
解压
tar -zxvf kafka-eagle-bin.tar.gz tar -zxvf kafka-eagle-bin-2.0.1/kafka-eagle-web-2.0.1-bin.tar.gz mv kafka-eagle-web-2.0.1 kafka-eagle
添加环境变量
vim /etc/profile export JAVA_HOME=/usr export KE_HOME=/etc/kafka-eagle export PATH=$PATH:$KE_HOME/bin:$JAVA_HOME/bin
生效环境变量
source /etc/profile
修改Kafka-eagle配置
cd /etc/kafka-eagle/conf vim system-config.properties
#注释 #cluster2.zk.list=xdn10:2181,xdn11:2181,xdn12:2181 #cluster2.kafka.eagle.offset.storage=zk #cluster1.zk.acl.enable=false #cluster1.zk.acl.schema=digest #cluster1.zk.acl.username=test #cluster1.zk.acl.password=test123 修改 kafka.eagle.zk.cluster.alias=cluster1 cluster1.zk.list=192.168.88.139:2181 kafka.eagle.metrics.charts=true kafka.eagle.driver=org.sqlite.JDBC kafka.eagle.url=jdbc:sqlite:/etc/kafka-eagle/db/ke.db kafka.eagle.username=root kafka.eagle.password=root 启动kafka-eagle服务 cd /etc/kafka-eagle/bin chmod +x ke.sh ke.sh start 开启防火墙 firewall-cmd --permanent --add-port=8048/tcp firewall-cmd --reload
浏览器访问:http://IP:8048
阿里云费用
以下截图基本以最低配置。
Kafka按量付费
Kafka包月
RabbitMQ包月