# Copyright © 2023 OpenIM. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #OpenIM config #---------------Infrastructure configuration---------------------# zookeeper: schema: openim #不建议修改 address: [ 127.0.0.1:2181 ] # username: #用户名 password: #密码 mysql: address: [ 127.0.0.1:13306 ] #目前仅支持单机 username: root #用户名 password: openIM123 #密码 database: openIM_v3 #不建议修改 maxOpenConn: 1000 #最大连接数 maxIdleConn: 100 #最大空闲连接数 maxLifeTime: 60 #连接可以重复使用的最长时间(秒) logLevel: 4 #日志级别 1=slient 2=error 3=warn 4=info slowThreshold: 500 #慢语句阈值 (毫秒) mongo: uri: #不为空则直接使用该值 address: [ 127.0.0.1:37017 ] #单机时为mongo地址,使用分片集群时,为mongos地址 database: openIM_v3 #mongo db 默认即可 username: root #用户名 password: openIM123 #密码 maxPoolSize: 100 redis: address: [ 127.0.0.1:16379 ] # username: #only redis version 6.0+ need username password: openIM123 #密码 kafka: username: #用户名 password: #密码 addr: [ 127.0.0.1:9092 ] # latestMsgToRedis: topic: "latestMsgToRedis" #不建议修改 offlineMsgToMongo: topic: "offlineMsgToMongoMysql" #不建议修改 msgToPush: topic: "msgToPush" #不建议修改 consumerGroupID: #消费者组,不建议修改 msgToRedis: redis # msgToMongo: mongo # msgToMySql: mysql # msgToPush: push # rpc: registerIP: #作为rpc启动时,注册到zookeeper的IP,api/gateway能访问到此ip和对应的rpcPort中的端口 listenIP: #默认为0.0.0.0 api: openImApiPort: [ 10002 ] #api服务端口 listenIP: #默认为0.0.0.0 object: enable: "minio" #使用minio apiURL: "http://127.0.0.1:10002/object/" minio: bucket: "openim" #不建议修改 endpoint: "http://127.0.0.1:10005" #minio对外服务的ip和端口,app要能访问此ip和端口 accessKeyID: "root" #ID secretAccessKey: "openIM123" #秘钥 sessionToken: "" #token cos: #tencent cos bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" secretID: "" secretKey: "" sessionToken: "" oss: #ali oss endpoint: "https://oss-cn-chengdu.aliyuncs.com" bucket: "demo-9999999" bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" accessKeyID: "" accessKeySecret: "" sessionToken: "" rpcPort: #rpc服务端口,不建议修改,端口由脚本读取后传入程序,如启动多个程序,只需要填入多个端口,用逗号隔开,如 [10110, 10111] openImUserPort: [ 10110 ] openImFriendPort: [ 10120 ] openImMessagePort: [ 10130 ] openImMessageGatewayPort: [ 10140 ] openImGroupPort: [ 10150 ] openImAuthPort: [ 10160 ] openImPushPort: [ 10170 ] openImConversationPort: [ 10180 ] openImThirdPort: [ 10190 ] rpcRegisterName: #rpc注册服务名,不建议修改 openImUserName: User openImFriendName: Friend openImMsgName: Msg openImPushName: Push openImMessageGatewayName: MessageGateway openImGroupName: Group openImAuthName: Auth openImConversationName: Conversation openImThirdName: Third log: storageLocation: ../../../../../logs/ #存放目录 rotationTime: 24 #日志旋转时间 remainRotationCount: 2 #日志数量 remainLogLevel: 6 #日志级别 6表示全都打印, isStdout: false isJson: false withStack: false longConnSvr: openImWsPort: [ 10001 ] #msg_gateway的websocket端口 websocketMaxConnNum: 100000 #websocket最大连接数 websocketMaxMsgLen: 4096 #websocket请求包最大长度 websocketTimeout: 10 #websocket连接握手超时时间 push: enable: getui geTui: #个推离线推送 pushUrl: "https://restapi.getui.com/v2/$appId" masterSecret: "" appKey: "" intent: "" channelID: "" channelName: "" fcm: #fcm离线推送 serviceAccount: "x.json" #帐号文件,并放在 config目录下 jpns: #极光推送 在极光后台申请后,修改以下四项 appKey: masterSecret: pushUrl: pushIntent: manager: userID: [ "openIM123456","openIM654321","openIMAdmin" ] #内置的app管理员userID nickname: [ "system1","system2", "system3" ] #内置的app管理员nickname multiLoginPolicy: 1 #多平台登录:Android、iOS、Windows、Mac、web 每种平台只能有一个在线 chatPersistenceMysql: true #消息是否存入mysql,mysql中的消息仅用于管理后台使用 msgCacheTimeout: 86400 #信消息缓存时间秒,不建议修改 groupMessageHasReadReceiptEnable: true #群聊已读是否开启 singleMessageHasReadReceiptEnable: true #单聊已读是否开启 retainChatRecords: 365 #mongo保存离线消息时间(天) chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期(超过retainChatRecords时间)消息,这个删除是为了清理满足上个配置retainChatRecords的过期消息,不会发送通知,仅仅作为清理磁盘使用 msgDestructTime: "0 2 * * *" #消息自动删除时间,每天凌晨2点删除过期消息,这个删除是为了删除保留时间超过超过会话字段msg_destruct_time(秒)的消息。 secret: tuoyun #秘钥,获取token时校验 tokenPolicy: expire: 90 #过期时间(天) messageVerify: friendVerify: false #发送消息时是否验证好友关系 #ios系统推送声音以及标记计数 iosPush: pushSound: "xxx" badgeCount: true production: false callback: # 回调callback url: beforeSendSingleMsg: enable: false #是否启用此回调事件 timeout: 5 #超时时间(秒) failedContinue: true #如回调失败是否继续往后执行 afterSendSingleMsg: enable: false timeout: 5 beforeSendGroupMsg: enable: false timeout: 5 failedContinue: true afterSendGroupMsg: enable: false timeout: 5 msgModify: enable: false timeout: 5 failedContinue: true userOnline: enable: false timeout: 5 userOffline: enable: false timeout: 5 userKickOff: enable: false timeout: 5 offlinePush: enable: false timeout: 5 failedContinue: true onlinePush: enable: false timeout: 5 failedContinue: true superGroupOnlinePush: enable: false timeout: 5 failedContinue: true beforeAddFriend: enable: false timeout: 5 failedContinue: true beforeCreateGroup: enable: false timeout: 5 failedContinue: true beforeMemberJoinGroup: enable: false timeout: 5 failedContinue: true beforeSetGroupMemberInfo: enable: false timeout: 5 failedContinue: true setMessageReactionExtensions: enable: false timeout: 5 failedContinue: true prometheus: #prometheus每个服务的端口数量需要和rpcPort保持对应 enable: false userPrometheusPort: [ 20110 ] friendPrometheusPort: [ 20120 ] messagePrometheusPort: [ 20130 ] messageGatewayPrometheusPort: [ 20140 ] groupPrometheusPort: [ 20150 ] authPrometheusPort: [ 20160 ] pushPrometheusPort: [ 20170 ] conversationPrometheusPort: [ 20230 ] rtcPrometheusPort: [ 21300 ] thirdPrometheusPort: [ 21301 ] messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] #端口数量需要和script/path_info.sh中的msg_transfer_service_num保持一致