以下分别对两台ECS作multicast功能配置。
2.1 安装Multicast
下载multicast代理:
https://github.com/aliyun/multicast_proxy
选择multicast_kernel目录,分别生成server端和client端:
sh tmcc_client_auto_rpm.sh
sh tmcc_server_auto_rpm.sh
安装multicast RPM包:
rpm -Uvh multi_server-1.1-1.x86_64.rpm
rpm -Uvh multi_client-1.1-1.x86_64.rpm
2.2 启动Multicast
配置开机启动:
chkconfig multis on --level 2345
chkconfig multis off --level 016
chkconfig multic on --level 2345
chkconfig multic off --level 016
启动服务:
service multis start
service multic start
2.3 配置Multicast
对两台ECS的公网以及私网分别设置multicast功能。
配置组播服务端:
#node1
/usr/local/sbin/multis_admin -A -m 224.0.0.251 -j $node2_ip
/usr/local/sbin/multis_admin -A -m 230.0.1.0 -j $node2_ip
#node2
/usr/local/sbin/multis_admin -A -m 224.0.0.251 -j $node1_ip
/usr/local/sbin/multis_admin -A -m 230.0.1.0 -j $node1_ip
配置组播客户端:
#node1
/usr/local/sbin/multic_admin -A -i $node2_ip -p 0 -m 224.0.0.251
/usr/local/sbin/multic_admin -A -i $node2_ip -p 0 -m 230.0.1.0
#node2
/usr/local/sbin/multic_admin -A -i $node1_ip -p 0 -m 224.0.0.251
/usr/local/sbin/multic_admin -A -i $node1_ip -p 0 -m 230.0.1.0
查看配置情况:
multis_admin -L -m 224.0.0.251
multis_admin -L -m 230.0.1.0
multic_admin -L
备注 keycloak JGroups MPING 配置:
开启debug 日志,找到mcast_addr IP,并按照上述说明完成配置
{"_log_type":"access-iam-kc","timestamp":"2022-05-26 21:19:26","level":"INFO","class":"org.infinispan.CLUSTER","task":"keycloak-cache-init","msg":"ISPN000078: Starting JGroups channel `ISPN`"}
{"_log_type":"access-iam-kc","timestamp":"2022-05-26 21:19:26","level":"DEBUG","class":"org.jgroups.stack.Configurator","task":"keycloak-cache-init","msg":"set property TCP.diagnostics_addr to default value /224.0.75.75"}
{"_log_type":"access-iam-kc","timestamp":"2022-05-26 21:19:26","level":"DEBUG","class":"org.jgroups.protocols.TCP","task":"keycloak-cache-init","msg":"thread pool min/max/keep-alive: 0/200/60000 use_fork_join=false, internal pool: 0/4/30000 (4 cores available)"}
{"_log_type":"access-iam-kc","timestamp":"2022-05-26 21:19:26","level":"DEBUG","class":"org.jgroups.protocols.MPING","task":"keycloak-cache-init","msg":"bind_addr=/172.26.6.244, mcast_addr=/228.6.7.8, mcast_port=46655"}
参考资料:
https://help.aliyun.com/document_detail/402340.html#h2-wgm-bik-t9e
仓库备份:
https://github.com/dzp-java/multicast_proxy