自行部署etcd/zookeeper/mysql/kafka/mongo/redis集群,可以根据此性能评估服务器需求。

以下是针对一台华为云主机s3的压测数据:8核16G内存,普通磁盘(非SSD)(一)单聊压测数据:1.1 同时在线及压测客户端数量:1万1.2 每秒钟发送消息量:2300条;1.3 从发送到对方接收平均消息延时:5秒(二)群聊压测数据:2.1 群成员数量:1万人2.2 同时在线人数:1千人2.3 每秒发送消息量:500条;2.4 从发送到对方接收平均消息延时: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

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;

  }
}

OpenIM集群(非k8s)部署文档的更多相关文章

  1. NVIDIA-GPU归入K8S集群管理的安装文档--第二版

    一,nvidia K80驱动安装 1,  查看服务器上的Nvidia(英伟达)显卡信息,命令lspci |grep NVIDIA 2,  按下来,进行显卡驱动程序的安装,驱动程序可到nvidia的官网 ...

  2. 如何诊断 11.2 集群节点驱逐问题 (文档 ID 1674872.1)

    适用于: Oracle Database - Enterprise Edition - 版本 11.2.0.1 到 11.2.0.2 [发行版 11.2]本文档所含信息适用于所有平台 用途 这篇文档提 ...

  3. Elasticsearch 使用集群 - 创建和查询文档

    章节 Elasticsearch 基本概念 Elasticsearch 安装 Elasticsearch 使用集群 Elasticsearch 健康检查 Elasticsearch 列出索引 Elas ...

  4. Greenplum/Deepgreen(集群/分布式)安装文档

    Deepgreen分布式安装文档 环境准备 1.安装VMware虚拟机软件,然后在VMware安装三台Linux虚拟机(使用centos7版本) 2.使用的虚拟机如下: 192.168.136.155 ...

  5. Ubuntu下搭建Kubernetes集群(3)--k8s部署

    1. 关闭swap并关闭防火墙 首先,我们需要先关闭swap和防火墙,否则在安装Kubernetes时会导致不成功: # 临时关闭 swapoff -a # 编辑/etc/fstab,注释掉包含swa ...

  6. RHEL 集群(RHCS)配置小记 -- 文档记录

    1.RHEL 6 集群配置官方管理手册 https://access.redhat.com/site/documentation/zh-CN/Red_Hat_Enterprise_Linux/6/pd ...

  7. Hadoop 集群搭建和维护文档

    一.前言 -- 基础环境准备 节点名称 IP NN DN JNN ZKFC ZK RM NM Master Worker master1 192.168.8.106 * * * * * * maste ...

  8. [k8s]zookeeper集群在k8s的搭建(statefulset模式)-pod的调度

    之前一直docker-compose跑zk集群,现在把它挪到k8s集群里. docker-compose跑zk集群 zk集群in k8s部署 参考: https://github.com/kubern ...

  9. HP DL160 Gen9服务器集群部署文档

    HP DL160 Gen9服务器集群部署文档 硬件配置=======================================================Server        Memo ...

  10. Redis集群部署文档(Ubuntu15.10系统)

    Redis集群部署文档(Ubuntu15.10系统)(要让集群正常工作至少需要3个主节点,在这里我们要创建6个redis节点,其中三个为主节点,三个为从节点,对应的redis节点的ip和端口对应关系如 ...

随机推荐

  1. 火山引擎 DataLeap 通过中国信通院测评,数据管理能力获官方认可!

      近日,火山引擎大数据研发治理套件 DataLeap 通过中国信通院第十五批"可信大数据"测评,在数据管理平台基础能力上获得认证.   "可信大数据"产品能力 ...

  2. 高性能 Jsonpath 框架,Snack3 v3.2.44 发布

    Snack3,一个高性能的 JsonPath 框架 借鉴了 Javascript 所有变量由 var 申明,及 Xml dom 一切都是 Node 的设计.其下一切数据都以ONode表示,ONode也 ...

  3. 互联网公司Python高性能编程

    虽然Python一直被吐槽执行速度慢,但是架不住简洁的语法和丰富的第三方库使其能够节省开发时间.众所周知在互联网公司中要求频繁的迭代.快速的上线,而Python的优点就特别适合这种需求,所以Pytho ...

  4. 数据工程师必备的8项技能,不要只知道Python!

    欢迎关注公众号:机器学习算法与Python实战(ID:tjxj666) 原作:Mohammed M Jubapu 译者:机器学习算法与Python实战(公众号ID:tjxj666) 英文:https: ...

  5. AISing Programming Contest 2021(AtCoder Beginner Contest 202) 简单题解记录

    补题链接:Here A - Three Dice 水题,问给定三次摇色子的正面,请问3次结果以后相对面的点数和 cout << (21 - a - b - c) << &quo ...

  6. Codeforces Round #674 (Div. 3) (A - F题题解)

    A. Floor Number https://codeforces.com/contest/1426/problem/A 题意: 一个楼房房间号由 \(1\) 递增,一楼仅2个房间.给定一位用户的房 ...

  7. InnoDB 事务加锁分析

    本文首发于 vivo互联网技术 微信公众号 链接:https://mp.weixin.qq.com/s/S7MhlsZveBHRSQhq5aTIJA作者:何志创 一般大家对数据库事务的了解可能停留在事 ...

  8. Java23种设计模式学习笔记

    创建型模式:关注对象的创建过程 1.单例​模式: 保证一个类只有一个实例,并且提供一个访问该实例的全局访问点 主要: 饿汉式(线程安全,调用效率高,但是不能延时加载) 懒汉式(线程安全,调用效率不高, ...

  9. vue中我改变了data中的一个值,但现在视图上没有实时更新,请问我怎么拿到更新后的值?

    Vue在数据初始化的时候会对data,computed,watcher中的属性进行依赖收集,如果支持proxy,则直接使用proxy进行拦截,好处是可以深层次的进行拦截,如果不支持proxy,则使用o ...

  10. AXI Channel

    AXI Channel axi与ahb不同就是分为不同的channel write address channel - 表明一个transaction基本的属性,包含本次传输的地址\类型\大小(多少字 ...