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
如何激发孩子的好奇心和探究欲?让他们置身大自然是最好的途径苏联著名教育家卡普杰列夫曾经提出儿童应该尽早而且长时间地投身于大自然中,从中吸取对它的营养,体验大自然在每个人心中激起的思想和感受。儿童需要亲眼看到太阳和月亮的起落。一句话,必须与
孩子戴了助听器,这个每天都在用的配件,家长一定要弄清楚家里如果有小朋友戴助听器,那家长对助听器耳模一定不陌生。关于助听器耳模,家长最常问的几个问题,今天一次给大家说清楚!什么是助听器耳模?助听器耳模主要是用来连接人耳和助听器的,需要根
吾爱吾师,吾更爱真理都说妈妈是孩子的第一任老师,如何说孩子才会听?今天一早居然不自觉运用了好几个故事讲道理。妈妈也不可能永远都对,但是绝大多数时候,希望我的孩子在未来成长道路上,能够尊重每一种不同观点
培养开放式大脑,让孩子自觉又主动让孩子自觉又主动读书笔记本书作者丹尼尔西格尔(DanielJ。Siege)是知名的教育家和心理学家,他首先引入开放式大脑和防御式大脑两个概念,通过两者对比认为我们要培养孩子的开放式
能够数据导学的OK学习机,如何让孩子爱上学习?对于学习机,许多家长朋友们都不陌生,其中有不少人也都有过尝试。但是,这款最新的OK学习机,采用完全数据化引导孩子学习的智慧学习方式,让孩子轻松学习的同时培养出良好的自主学习习惯!具
小朋友为什么牙齿会坏这么多呢?最近门诊接待了好几个不爱刷牙,导致口腔卫生状况非常不好的小朋友,牙医也告诉我们,在临床经验中最普遍的儿牙问题是龋齿。今天就来讲一讲小朋友为什么牙齿会坏这么多呢?在和家长们的沟通中我
孩子溺水,这个流传最广的急救方法是错的,会耽误最佳抢救时间每年暑假一到,儿童溺水的新闻就特别多,据统计,每年我国因溺水致死的儿童高达3万人,其中15岁以下的儿童占比最大!而之所以溺水的死亡率高,一方面是孩子溺水家长很难发现,二是一些错误的
一孕傻三年,这是真的?有科学依据图片来源网络准妈妈应该都听过一句俗语,叫一孕傻三年。刚开始肯定很多人都不信,但产后的种种迹象总是让准妈妈们啪啪打脸。曾经看过一个妈妈在群里分享产后趣事有一天去买菜,西红柿10块,茄
妈妈怀孕时爱喝可乐,宝宝出生黑成了酱油,爸爸为此哭了三天怀孕时,很多准妈妈不管在饮食方面,还是其他方面都是小心翼翼的,生怕因为自己一时贪食或者不注意,就会伤害到自己肚子里的孩子。吃什么,或者是做什么都小心翼翼的,生怕会出什么岔子。可有的
天热没食欲,多给孩子做它,既长个子又补脑,香甜软糯特开胃孩子放假啦,趁周末,把老房子整理了出来准备出租。整整收拾了两天,住了十年的房子,简直像个大仓库,哪哪都是东西,装了三四十麻袋,这下终于知道钱到底哪去了哈哈!大夏天的,真的是热得无处
6条国内自驾游最美公路!此生必去一次风景一直都在路上,不要等任何人,一起和心灵出发吧去看看我们国内最美的6大公路,在这一路领略祖国大好江山的四季美景。1。G318川藏线410月中国国家地理认证的最美公路,此生必去公路