IM开源项目OpenIM集群(非k8s)部署文档生产环境可参考
自行部署etcd/zookeeper/mysql/kafka/mongo/redis集群,可以根据此性能评估服务器需求。
以下是针对一台华为云主机s3的压测数据:8核16G内存,普通磁盘(非SSD)
(一)单聊压测数据:
同时在线及压测客户端数量:1万
每秒钟发送消息量:2300条;
从发送到对方接收平均消息延时:5秒
(二)群聊压测数据:
群成员数量:1万人
同时在线人数:1千人
每秒发送消息量:500条;
从发送到对方接收平均消息延时:6秒
组件集群说明
组件
说明
版本
etcd
建议三台,可复用
3.5.0
zookeeper
建议三台,可复用
3.7.1
mysql
主从两条,可复用
5.7
kafka
建议三台,可复用。以2台8核16G IM Server为例说明topic分区设置,"ws2ms_chat" 8分区,"msg_to_mongo" 8分区,"ms2ps_chat" 10分区
3.2.0
mongo
建议2台以上,可复用。每个cache限制0.5G;多个数据分片副本集,1个mongos副本集,1个config副本集
5.0
redis
建议2台以上,可复用。每个内存限制10G, 淘汰策略volatile-ttl
6.2.5 IM Server集群部署(1)下载代码及编译git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive cd Open-IM-server/script chmod +x *.sh ./batch_build_all_service.sh 出现all services build success表示所有模块编译成功(2)修改组件信息kafka: ws2mschat: addr: [ 127.0.0.1:9092, 127.0.0.2:9092, 127.0.0.3:9092 ] # topic: "ws2ms_chat" open_im_msg写入,open_im_msg_transfer消费后新消息入库redis和kafka "msg_to_mongo" 、 "ms2ps_chat" ws2mschatoffline: addr: [ 127.0.0.1:9092, 127.0.0.2:9092, 127.0.0.3:9092 ] #kafka配置,默认即可 topic: "ws2ms_chat_offline" 不再使用 msgtomongo: addr: [ 127.0.0.1:9092, 127.0.0.2:9092, 127.0.0.3:9092 ] #kafka配置,默认即可 topic: "msg_to_mongo" open_im_msg_transfer消费历史消息入库mongo ms2pschat: addr: [ 127.0.0.1:9092, 127.0.0.2:9092, 127.0.0.3:9092 ] #kafka配置,默认即可 topic: "ms2ps_chat" open_im_push消费,推送消息到open_im_msg_gateway etcd: etcdSchema: openim #默认即可 etcdAddr: [ 127.0.0.1:2379, 127.0.0.2:2379, 127.0.0.3:2379] #etcd集群 mysql: dbMysqlAddress: [ 127.0.0.1:13306, 127.0.0.2:13306] #mysql主备 mongo: dbAddress: [127.0.0.1:37017, 127.0.0.2:37017, 127.0.0.3:37017] #使用分片集群时为mongos地址 redis: dbAddress: [ 127.0.0.1:16379, 127.0.0.2:16379, 127.0.0.3:16379 ] #redis集群 rpcRegisterIP:#不要填写 (3)调整进程数
open_im_msg 6个,open_im_push 5个 openImMessagePort: [ 10130, 10131, 10132, 10133, 10134,10135 ] #open_im_msg 配置6个端口则启动6个进程 openImPushPort: [ 10170, 10171, 10172, 10173, 10174 ] #open_im_push 配置5个端口则启动5个进程
open_im_msg_transfer 4个 修改script/path_info.cfg msg_transfer_name="open_im_msg_transfer" msg_transfer_binary_root="../bin/" msg_transfer_source_root="../cmd/open_im_msg_transfer/" msg_transfer_service_num=4(4)复制Open-IM-Server到其他服务器scp -r Open-IM-Server root@127.0.0.2:/data(5)启动cd script ./start_all.sh 关于OpenIM
OpenIM是由IM技术专家打造开源即时通讯组件,也是目前最受欢迎的开源IM项目之一,开发者通过集成OpenIM组件,并私有化部署服务端,可以将即时通讯、实时通讯能力快速集成到自身应用中,并确保业务数据的安全性和私密性。github社区活跃,star近万,排名遥遥领先,开发者万人,OpenM力争开源IM项目No1,打造开源IM第一社区。OpenIM是也是目前非常受欢迎的开源IM项目,广泛用于政企协同办公场景。
github地址:https://github.com/OpenIMSDK/Open-IM-Server
开发者中心:https://doc.rentsoft.cn/#/
平台支持:Android iOS Uniapp Flutter Electron Web reactNative等几乎所有平台
pc支持信创环境:银河麒麟 UOS等;
群组支持:十万群成员的超级大群
安卓基于自启动-保活机制
nginx配置示例
https/wss配置;负载均衡配置;以IM Server两台 127.0.0.1 127.0.0.2 , nginx部署在其他服务器为例。
注意域名 替换ip 域名以及证书 upstream msg_gatway_imserver{ server 127.0.0.1:10001; server 127.0.0.2:10001; } upstream api_imserver{ server 127.0.0.1:10002; server 127.0.0.2:10002; } upstream jssdk_imserver{ server 127.0.0.1:10003; server 127.0.0.2:10003; } upstream demo_imserver{ server 127.0.0.1:10004; server 127.0.0.2:10004; } upstream cms_imserver{ server 127.0.0.1:10006; server 127.0.0.2:10006; } server { listen 443; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; error_page 405 =200 $uri; location / { proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-NginX-Proxy true; root /data/online/Pc-Web-Demo/build/; index index.html; try_files $uri $uri/ /index.html; } location /admin { proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-NginX-Proxy true; # root /data/online/Open-IM-Admin/build/; alias /data/online/Open-IM-Admin/build/; index index.html; try_files $uri $uri/admin/ /admin/index.html; } } server { listen 80; server_name open-im-online.rentsoft.cn; rewrite ^(.*)$ https://${server_name}$1 permanent; } server { listen 10001; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://msg_gatway_imserver; } } server { listen 10002; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://api_imserver; } } server { listen 10003; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://jssdk_imserver; } } server { listen 10004; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://demo_imserver; } } server { listen 10006; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://cms_imserver; } } server { listen 7880; server_name open-im-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/open-im-online.rentsoft.cn.key; ssl_session_timeout 5m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://127.0.0.1:7880; } } upstream storage { server 127.0.0.1:10005; } server { # listen 443; # server_name storage-online.rentsoft.cn; # ssl on # ssl_certificate /etc/nginx/conf.d/ssl/storage-online.rentsoft.cn_bundle.crt; # ssl_certificate_key /etc/nginx/conf.d/ssl/storage-online.rentsoft.cn.key; ssl_session_timeout 5m; listen 443; server_name storage-online.rentsoft.cn; ssl on; ssl_certificate /etc/nginx/conf.d/ssl/storage-online.rentsoft.cn_nginx/storage-online.rentsoft.cn_bundle.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/storage-online.rentsoft.cn_nginx/storage-online.rentsoft.cn.key; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; location / { proxy_pass http://127.0.0.1:10005/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_http_version 1.1; client_max_body_size 8000M; } } 1
壳牌重新考虑石油产量削减计划据oedigital网站2023年3月3日伦敦报道,英国能源巨头壳牌公司首席执行官WaelSawan在伦敦告诉泰晤士报记者,在其竞争对手英国石油公司(bp)最近削减碳氢化合物产量目
苏州园区房价高真正的原因,你知道吗?园区的房价比苏州市均价高了近一倍的真正原因是什么?其实每个城市的高房价区域都是有规律的,仔细看完这篇文章,结尾会有总结。1。政策支持,苏州工业园区,作为中新国际合作的成功范例,自成
房地产全面取消限售的大潮开始了今年以来,地方政策从试探性松绑到应出尽出,需求侧宽松政策仍在继续。3月6日,长沙对住房限售政策做出调整,网签满4年可以进行交易!内五区从本月2日起开始执行新政(星沙望城暂不跟进)来
比尔盖茨断供光刻机就是在提前向中国警告开战!假如我们真的认为在未来要和中国开战,那我们为什么还要提前警告中国我们要对他们断供?为什么要逼着他们开始生产自己的芯片?这是比尔盖茨在接受金融时报采访中所谈到在关于美国禁止向中国出售
新能源车就要有车没电?质疑中国新能源产业的底气从何而来!这是一篇微头条引发的话题,它来自自诩海派清口创始人的周立波!近日,周立波用他一贯的俏皮话,发布了一篇与海派清口八百杆子打不着的内容,质疑中国新能源车和绿色能源产业思路。他称发展电动
最大750平,单店年入400万,我在三四线开超级大店疫情3年,大部分品牌都把店越开越小。但最近,我在福建漳州发现了一个超级大店模式只在三四线城市开,主做100500平的大店,2年时间开出50家门店。其中,最大的门店有三层楼,750平
将斥资约2亿澳元,日企下重本买澳洲稀土,欲摆脱对华依赖?据日媒3月9日的相关报道显示,日本企业将采购澳大利亚的稀土巨头莱纳斯公司即将开始生产的重稀土,此次签约估计可以满足日本国内近3成的需求。而日本企业此次所获得的是重稀土当中镝和铽的权
福建一老伯晒出酒单,却因无名酒惹争议,行家这才是懂酒的人白酒是中国人的国酒,也是很多人喜爱的佳酿。但是,在市场上,有些白酒因为品牌知名度高而价格昂贵,有些白酒则因为不出名而被忽视。其实,不出名并不代表不好喝,反而可能隐藏着许多惊喜。近日
工友创业园落地开花务工者乐采致富蜜原标题专业合作社田园综合体农创产业园(引题)工友创业园落地开花务工者乐采致富蜜(主题)工人日报中工网记者周怿通讯员李莉刘荣亮阅读提示近年来,以工友创业园为代表的各类创业园项目,成为
强信心开新局1月新增信贷4。9万亿元,创下单月历史新高截至1月,全国经营主体达1。7亿户制造业采购经理指数2月继续回升开年以来,我国经济快速复苏,为经济社会发展注入强大信心。中央经济工作会议提
践行雷锋精神传递红色爱心红网时刻新闻3月9日讯(通讯员唐坚何可颖)相约明媚春日,践行雷锋精神。为深入学习贯彻党的二十大精神,进一步传承和践行雷锋精神,满足辖区居民群众实际需求,3月9日,长沙市芙蓉区韭菜园