You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/docs/contrib/environment.md

4.2 KiB

OpenIM enviroment

How to change the configuration

Modify the configuration files:

Three ways to modify the configuration:

export PASSWORD="openIM123" # Set password
export USER="root" # Set username
# Choose chat version and server version https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md, eg: main, release-v*.*
export CHAT_BRANCH="main"
export SERVER_BRANCH="main"
#... Other environment variables
# MONGO_USERNAME: This sets the MongoDB username
# MONGO_PASSWORD: Set the MongoDB password
# MONGO_DATABASE: Sets the MongoDB database name
# MINIO_ENDPOINT: set the MinIO service address
# API_URL: under network environment, set OpenIM Server API address
export API_URL="http://127.0.0.1:10002"

Next, update the configuration using make init:

make init

2. Modify the automation script:

scripts/install/environment.sh

Next, update the configuration using make init:

make init

3. Modify config.yaml and .env files (but will be overwritten when using make init again).

The config/config.yaml file has detailed configuration instructions for the storage components.

The config file is available via environment.sh configuration openim.yaml template, and then through the make init to automatically generate a new configuration.

Configuration Details

Zookeeper
  • Purpose: Used for RPC service discovery and registration, cluster support.

    zookeeper:
      schema: openim                          # Not recommended to modify
      address: [ 127.0.0.1:2181 ]            # Address
      username:                               # Username
      password:                               # Password
    
MySQL
  • Purpose: Used for storing users, relationships, and groups. Supports master-slave database.

    mysql:
      address: [ 127.0.0.1:13306 ]            # Address
      username: root                          # Username
      password: openIM123                     # Password
      database: openIM_v2                     # Not recommended to modify
      maxOpenConn: 1000                       # Maximum connection
      maxIdleConn: 100                        # Maximum idle connection
      maxLifeTime: 60                         # Max time a connection can be reused (seconds)
      logLevel: 4                             # Log level (1=silent, 2=error, 3=warn, 4=info)
      slowThreshold: 500                      # Slow statement threshold (milliseconds)
    
Mongo
  • Purpose: Used for storing offline messages. Supports mongo sharded clusters.

    mongo:
      uri:                                    # Use this value directly if not empty
      address: [ 127.0.0.1:37017 ]            # Address
      database: openIM                        # Default mongo db
      username: root                          # Username
      password: openIM123                     # Password
      maxPoolSize: 100                        # Maximum connections
    
Redis
  • Purpose: Used for storing message sequence numbers, latest messages, user tokens, and MySQL cache. Supports cluster deployment.

    redis:
      address: [ 127.0.0.1:16379 ]            # Address
      username:                               # Username
      password: openIM123                     # Password
    
Kafka
  • Purpose: Used for message queues for decoupling. Supports cluster deployment.

    kafka:
      username:                               # Username
      password:                               # Password
      addr: [ 127.0.0.1:9092 ]                # Address
      topics:
        latestMsgToRedis: "latestMsgToRedis"
        offlineMsgToMongo: "offlineMsgToMongoMysql"
        msgToPush: "msgToPush"
        msgToModify: "msgToModify"
      consumerGroupID:
        msgToRedis: redis
        msgToMongo: mongo
        msgToMySql: mysql
        msgToPush: push
        msgToModify: modify
    

Config options

...