Files
open-im-server/config/config.yaml
T

322 lines
11 KiB
YAML
Raw Normal View History

2021-05-26 18:47:52 +08:00
# The class cannot be named by Pascal or camel case.
# If it is not used, the corresponding structure will not be set,
# and it will not be read naturally.
2023-02-08 17:56:04 +08:00
serverversion: 2.3.7
2021-05-26 18:47:52 +08:00
#---------------Infrastructure configuration---------------------#
2023-02-08 17:56:04 +08:00
zookeeper:
schema: openim #默认即可
zkAddr: [ 127.0.0.1:2181 ] #单机部署时,默认即可
2022-09-16 11:57:01 +08:00
userName:
2022-09-16 15:11:13 +08:00
password:
2021-11-29 11:25:57 +08:00
2021-05-26 18:47:52 +08:00
mysql:
2022-03-02 19:07:17 +08:00
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
2023-02-23 19:15:30 +08:00
dbMysqlUserName: root #mysql用户名,建议修改
dbMysqlPassword: openIM123 # mysql密码,建议修改
2022-02-23 18:22:44 +08:00
dbMysqlDatabaseName: openIM_v2 #默认即可
dbTableName: eMsg #默认即可
2021-05-26 18:47:52 +08:00
dbMsgTableNum: 1
2022-08-30 21:22:14 +08:00
dbMaxOpenConns: 100
dbMaxIdleConns: 10
dbMaxLifeTime: 5
2023-05-09 15:23:36 +08:00
logLevel: 4 #1=slient 2=error 3=warn 4=info
2022-09-14 17:45:38 +08:00
slowThreshold: 500
2021-05-26 18:47:52 +08:00
mongo:
2022-03-21 11:13:17 +08:00
dbUri: ""#当dbUri值不为空则直接使用该值
2022-09-16 16:17:21 +08:00
dbAddress: [ 127.0.0.1:37017 ] #单机时为mongo地址,使用分片集群时,为mongos地址 默认即可
2021-05-26 18:47:52 +08:00
dbDirect: false
2022-05-20 20:11:47 +08:00
dbTimeout: 60
2022-02-23 18:22:44 +08:00
dbDatabase: openIM #mongo db 默认即可
2021-05-26 18:47:52 +08:00
dbSource: admin
2023-02-23 19:15:30 +08:00
dbUserName: root #mongo用户名,建议先不设置
dbPassword: openIM123 #mongo密码,建议先不设置
2022-05-20 20:11:47 +08:00
dbMaxPoolSize: 100
2022-02-23 18:22:44 +08:00
dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改
2023-03-14 14:26:44 +08:00
chatRecordsClearTime: "0 2 * * 3" # 每周三凌晨2点清除消息,该配置和linux定时任务一样, 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
2021-05-26 18:47:52 +08:00
redis:
2022-07-11 11:01:41 +08:00
dbAddress: [ 127.0.0.1:16379 ] #redis地址 单机时,填写一个地址即可,使用redis集群时候,填写集群中多个节点地址(主从地址都可以填写,增加容灾能力),默认即可
2021-05-26 18:47:52 +08:00
dbMaxIdle: 128
dbMaxActive: 0
dbIdleTimeout: 120
2022-07-11 11:00:32 +08:00
dbUserName: #only redis version 6.0+ need username
2023-02-23 19:15:30 +08:00
dbPassWord: openIM123 #redis密码 建议修改
2022-07-11 11:02:56 +08:00
enableCluster: false #如果外部redis以集群方式启动,需要打开此开关
2021-05-26 18:47:52 +08:00
kafka:
2023-05-31 16:54:11 +08:00
SASLUserName:
2022-09-16 16:51:12 +08:00
SASLPassword:
2021-05-26 18:47:52 +08:00
ws2mschat:
2022-02-23 18:22:44 +08:00
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
topic: "ws2ms_chat" #用于mongo和mysql保存消息
2022-06-16 12:21:49 +08:00
msgtomongo:
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
topic: "msg_to_mongo"
2021-05-26 18:47:52 +08:00
ms2pschat:
2022-02-23 18:22:44 +08:00
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
topic: "ms2ps_chat" #消息push
2022-12-12 19:22:50 +08:00
msgtomodify:
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
topic: "msg_to_modify"
2021-05-26 18:47:52 +08:00
consumergroupid:
2022-06-17 10:59:50 +08:00
msgToTransfer: mongo
msgToMongo: mongo_ex
2021-05-26 18:47:52 +08:00
msgToMySql: mysql
msgToPush: push
2022-12-12 19:22:50 +08:00
msgToModify: modify
2021-05-26 18:47:52 +08:00
#---------------Internal service configuration---------------------#
# The service ip default is empty,
# automatically obtain the machine's valid network card ip as the service ip,
# otherwise the configuration ip is preferred
2022-02-23 18:22:44 +08:00
#如果是单机模式,用0.0.0.0或者不填,默认即可
2021-05-26 18:47:52 +08:00
2022-07-01 14:59:53 +08:00
#作为rpc时,注册到etcd的地址,单机默认即可,如果是集群部署,需要修改(具体使用内网地址还是外网地址,要依情况而定,目的是api/gateway能访问到)
2022-08-17 11:35:33 +08:00
rpcRegisterIP:
2022-07-01 14:59:53 +08:00
#默认即可
2022-05-07 17:05:05 +08:00
listenIP: 0.0.0.0
2021-11-25 13:57:11 +08:00
api:
2022-04-25 15:45:39 +08:00
openImApiPort: [ 10002 ] #api服务端口,默认即可,需要开放此端口或做nginx转发
2022-05-07 19:52:18 +08:00
listenIP: 0.0.0.0
2023-02-10 18:13:58 +08:00
2021-09-27 21:03:36 +08:00
sdk:
2022-04-25 15:45:39 +08:00
openImSdkWsPort: [ 10003 ] #jssdk服务端口,默认即可,项目中使用jssdk才需开放此端口或做nginx转发
2022-05-07 19:52:18 +08:00
dataDir: [ ../db/sdk/ ]
2022-08-24 16:20:31 +08:00
openImWsAddress: ws://127.0.0.1:10001
openImApiAddress: http://127.0.0.1:10002
2022-03-15 17:25:31 +08:00
#对象存储服务,以下配置二选一,目前支持两种,腾讯云和minio,二者配置好其中一种即可(如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器)
2022-02-23 18:22:44 +08:00
credential: #腾讯cos,发送图片、视频、文件时需要,请自行申请后替换,必须修改
2023-03-14 19:33:44 +08:00
object:
enable: minio
2023-04-23 11:44:33 +08:00
apiURL: http://127.0.0.1:10002/third/object
2023-03-28 15:04:40 +08:00
minio: #MinIO 发送图片、视频、文件时需要,请自行申请后替换,必须修改。 客户端初始化InitSDK,中 object_storage参数为minio
tempBucket: "openim"
dataBucket: "openim"
location: us-east-1
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
accessKeyID: root
secretAccessKey: openIM123
isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false,如果是多硬盘部署,需要修改为true
2021-05-26 18:47:52 +08:00
tencent:
2023-03-14 19:33:44 +08:00
appID:
region:
bucket:
secretID:
secretKey:
2022-03-21 11:13:17 +08:00
ali: # ali oss
2023-03-14 19:33:44 +08:00
regionID:
accessKeyID:
accessKeySecret:
stsEndpoint:
ossEndpoint:
bucket:
finalHost:
stsDurationSeconds:
OssRoleArn:
2022-07-31 01:14:26 +08:00
aws:
2023-02-02 17:51:59 +08:00
accessKeyID: #AssumeRole用户关联的accessKeyID
accessKeySecret: #AssumeRole用户关联的accessKeySecrect
region: #分区
bucket: #桶
finalHost: #对外Host
roleArn: #RoleArn
externalId: #角色扩展Id
roleSessionName: #角色SESSION名称
2022-02-21 16:41:56 +08:00
2022-02-23 18:22:44 +08:00
rpcport: #rpc服务端口 默认即可
2022-04-25 16:21:48 +08:00
openImUserPort: [ 10110 ]
openImFriendPort: [ 10120 ]
openImMessagePort: [ 10130 ]
openImMessageGatewayPort: [ 10140 ]
openImGroupPort: [ 10150 ]
openImAuthPort: [ 10160 ]
openImPushPort: [ 10170 ]
2023-03-06 11:24:13 +08:00
openImConversationPort: [ 10180 ]
openImRtcPort: [ 10190 ]
2023-05-31 16:54:11 +08:00
openImThirdPort: [ 10200 ]
2021-05-26 18:47:52 +08:00
2022-02-23 18:22:44 +08:00
rpcregistername: #rpc注册服务名,默认即可
2022-02-09 16:22:58 +08:00
openImUserName: User
2021-05-26 18:47:52 +08:00
openImFriendName: Friend
2022-07-20 21:40:11 +08:00
openImMsgName: Msg
2021-05-26 18:47:52 +08:00
openImPushName: Push
2023-02-22 19:51:14 +08:00
openImMessageGatewayName: MessageGateway
2021-05-26 18:47:52 +08:00
openImGroupName: Group
2021-10-11 18:18:50 +08:00
openImAuthName: Auth
2022-04-24 11:23:54 +08:00
openImConversationName: Conversation
2023-02-22 19:51:14 +08:00
openImRtcName: Rtc
2023-03-06 11:24:13 +08:00
openImThirdName: Third
2023-02-10 18:19:40 +08:00
2021-05-26 18:47:52 +08:00
log:
storageLocation: ../logs/
2021-10-11 18:18:50 +08:00
rotationTime: 24
2022-07-15 15:17:54 +08:00
remainRotationCount: 2 #日志数量
2022-03-04 16:24:28 +08:00
#日志级别 6表示全都打印,测试阶段建议设置为6
2023-04-17 18:47:03 +08:00
remainLogLevel: 6
2023-04-18 16:38:11 +08:00
isStdout: false
isJson: false
2023-03-17 12:12:32 +08:00
withStack: false
2021-05-26 18:47:52 +08:00
2022-02-23 18:22:44 +08:00
modulename: #日志文件按模块命名,默认即可
2021-05-26 18:47:52 +08:00
longConnSvrName: msg_gateway
msgTransferName: msg_transfer
pushName: push
longconnsvr:
2022-04-25 15:45:39 +08:00
openImWsPort: [ 10001 ] # ws服务端口,默认即可,要开放此端口或做nginx转发
2021-05-26 18:47:52 +08:00
websocketMaxConnNum: 10000
websocketMaxMsgLen: 4096
websocketTimeOut: 10
2022-04-15 18:22:27 +08:00
## 推送只能开启一个 enable代表开启
2021-05-26 18:47:52 +08:00
push:
2022-02-23 18:22:44 +08:00
tpns: #腾讯推送,暂未测试 暂不要使用
2021-05-26 18:47:52 +08:00
ios:
accessID: 1600018281
secretKey: 3cd68a77a95b89e5089a1aca523f318f
android:
accessID: 111
secretKey: 111
2022-11-10 14:51:35 +08:00
enable: false # true or false (bool)
2022-02-23 18:22:44 +08:00
jpns: #极光推送 在极光后台申请后,修改以下四项,必须修改
2023-05-31 16:54:11 +08:00
appKey:
masterSecret:
pushUrl:
pushIntent:
2022-11-10 14:51:35 +08:00
enable: false # true or false (bool)
2023-05-31 16:54:11 +08:00
getui: #个推推送
2023-02-23 19:15:30 +08:00
pushUrl: "https://restapi.getui.com/v2/$appId"
2022-04-08 16:15:22 +08:00
masterSecret: ""
2022-04-08 15:40:07 +08:00
appKey: ""
intent: ""
2023-02-23 19:15:30 +08:00
enable: false # true or false (bool)
2022-09-07 18:20:41 +08:00
channelID: ""
channelName: ""
2023-05-31 16:54:11 +08:00
fcm: #firebase cloud message 消息推送
2022-07-29 15:23:09 +08:00
serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
2022-07-29 17:54:50 +08:00
enable: false
2022-04-08 16:15:22 +08:00
2021-09-26 14:26:45 +08:00
manager:
2022-02-23 18:22:44 +08:00
#app管理员userID和对应的secret 建议修改。 用于管理后台登录,也可以用户管理后台对应的api
2023-05-31 16:54:11 +08:00
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin" ]
2023-03-13 12:15:25 +08:00
nickname: [ "系统通知","openIM654321", "openIM333", "openIMAdmin" ]
2021-05-26 18:47:52 +08:00
2023-02-23 19:15:30 +08:00
secret: tuoyun
2022-02-23 18:22:44 +08:00
# 多端互踢策略
# 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线
2021-11-25 14:12:52 +08:00
multiloginpolicy: 1
2021-05-26 18:47:52 +08:00
2022-07-20 21:26:52 +08:00
#msg log insert to db
2022-05-19 12:25:46 +08:00
chatpersistencemysql: true
2022-05-24 17:22:17 +08:00
#消息缓存时间
2022-06-17 15:48:40 +08:00
msgCacheTimeout: 86400
2022-06-09 12:39:28 +08:00
#群聊已读开启
2022-06-16 11:45:52 +08:00
groupMessageHasReadReceiptEnable: true
2022-06-09 12:39:28 +08:00
#单聊已读开启
2022-06-16 11:45:52 +08:00
singleMessageHasReadReceiptEnable: true
2022-06-09 12:39:28 +08:00
2021-05-26 18:47:52 +08:00
#token config
tokenpolicy:
2023-02-23 19:15:30 +08:00
accessSecret: "OpenIM_server" #token生成相关,默认即可
# Token effective time day as a unit
2023-02-23 19:15:30 +08:00
accessExpire: 90 #token过期时间(天) 默认即可
2022-03-18 17:44:50 +08:00
messageverify:
2023-02-23 19:15:30 +08:00
friendVerify: false
2021-05-31 10:03:57 +08:00
2022-02-23 18:22:44 +08:00
#ios系统推送声音以及标记计数
2022-02-08 19:22:15 +08:00
iospush:
2021-12-20 16:29:24 +08:00
pushSound: "xxx"
2021-12-21 21:40:50 +08:00
badgeCount: true
2022-06-21 11:28:02 +08:00
production: false
2021-12-20 16:29:24 +08:00
2022-02-28 17:57:03 +08:00
callback:
2022-03-04 18:03:22 +08:00
# callback url 需要自行更换callback url
2023-06-05 17:47:32 +08:00
callbackUrl: "http://127.0.0.1:10008/callback/open_im"
2022-02-28 17:57:03 +08:00
# 开启关闭操作前后回调的配置
2022-05-26 18:08:29 +08:00
callbackBeforeSendSingleMsg:
2022-03-04 18:37:55 +08:00
enable: false # 回调是否启用
2022-03-03 19:23:16 +08:00
callbackTimeOut: 2 # 回调超时时间
2022-03-11 17:37:01 +08:00
callbackFailedContinue: true # 回调超时是否继续执行代码
2022-02-28 17:57:03 +08:00
callbackAfterSendSingleMsg:
2022-03-04 18:37:55 +08:00
enable: false
2022-03-03 19:23:16 +08:00
callbackTimeOut: 2
2022-02-28 17:57:03 +08:00
callbackBeforeSendGroupMsg:
2022-03-04 18:37:55 +08:00
enable: false
2022-03-03 19:23:16 +08:00
callbackTimeOut: 2
2022-03-11 17:37:01 +08:00
callbackFailedContinue: true
2022-02-28 17:57:03 +08:00
callbackAfterSendGroupMsg:
2022-03-04 18:37:55 +08:00
enable: false
2022-03-03 19:23:16 +08:00
callbackTimeOut: 2
2022-10-21 15:44:55 +08:00
callbackMsgModify:
2022-03-04 18:37:55 +08:00
enable: false
2022-03-03 19:23:16 +08:00
callbackTimeOut: 2
2022-03-11 17:37:01 +08:00
callbackFailedContinue: true
2022-05-26 18:08:29 +08:00
callbackUserOnline:
2022-05-27 13:16:05 +08:00
enable: false
2022-05-26 18:08:29 +08:00
callbackTimeOut: 2
callbackUserOffline:
2022-05-27 13:16:05 +08:00
enable: false
2022-05-26 18:08:29 +08:00
callbackTimeOut: 2
2022-08-11 15:55:33 +08:00
callbackUserKickOff:
enable: false
callbackTimeOut: 2
2022-05-26 18:08:29 +08:00
callbackOfflinePush:
2022-05-27 15:14:12 +08:00
enable: false
2022-05-26 18:08:29 +08:00
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续离线推送
2022-07-29 14:36:07 +08:00
callbackOnlinePush:
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续离线推送
callbackSuperGroupOnlinePush:
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续离线推送
2022-10-19 21:06:48 +08:00
callbackBeforeAddFriend:
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续
2022-10-21 15:44:55 +08:00
callbackBeforeCreateGroup:
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续
2022-11-22 11:07:20 +08:00
callbackBeforeMemberJoinGroup:
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续
2022-12-16 16:54:18 +08:00
callbackBeforeSetGroupMemberInfo:
2022-12-07 21:12:48 +08:00
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续
2022-12-09 12:13:14 +08:00
callbackSetMessageReactionExtensions:
2022-12-07 21:12:48 +08:00
enable: false
callbackTimeOut: 2
callbackFailedContinue: true # 回调超时是否继续
2022-02-28 17:57:03 +08:00
2022-04-05 10:27:34 +08:00
rtc:
2022-06-15 10:34:32 +08:00
signalTimeout: 35
2022-09-08 01:27:05 +08:00
2022-09-12 19:32:24 +08:00
# prometheus每个服务监听的端口数量需要和rpc port保持一致
2022-09-09 01:10:06 +08:00
prometheus:
enable: false
userPrometheusPort: [ 20110 ]
friendPrometheusPort: [ 20120 ]
messagePrometheusPort: [ 20130 ]
messageGatewayPrometheusPort: [ 20140 ]
groupPrometheusPort: [ 20150 ]
authPrometheusPort: [ 20160 ]
pushPrometheusPort: [ 20170 ]
conversationPrometheusPort: [ 20230 ]
2023-03-06 11:24:13 +08:00
rtcPrometheusPort: [ 21300 ]
2023-02-02 17:25:09 +08:00
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 端口数量和 script/path_info.cfg msg_transfer_service_num保持一致
2023-03-28 15:04:40 +08:00