MicroStrategy ONE

로드 밸런서 및 클러스터링 Library: 설정 작업 흐름 예

Redis 서버 설치 및 구성

  1. Redis를 설치하려면 다음을 참조하세요. Redis 시작하기.
  2. Redis 서버를 실행합니다.
  3. 'PING' 명령을 보내 Redis가 제대로 작동하는지 확인하세요. redis-cli.

    Redis 서버가 양호하면 'PONG'이 응답됩니다.

    복사
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>

    협업 서버에는 수평적 클러스터링을 위해 실행 중인 Redis 서버에 연결하기 위한 URL이 필요합니다.

    : redis://redis_host_machine:6379

    외부 트래픽을 허용할 수 있도록 Redis 구성 파일을 수정합니다.

    • Redis 구성 파일(redis.conf 또는 redis.windows-service.conf), 추가/변경 bind 입장 bind 0.0.0.0
    • 수정 사항을 저장하고 Redis 서버를 다시 시작하세요.

협업 서버 구성

  1. 서로 다른 시스템에 설치된 모든 협업 서버의 경우 구성 파일에서 Redis 서버 URL, 웹 로드 밸런서 URL, 클러스터링 모드를 설정합니다.

    복사
    {
    "port": 3000,
    "dataSource": {"username": "mstr_collab","password": "xxx"},
    "logging": true,
    "authorizationServerUrl":"<web_load_balancer_url>/api",
    "scaling": "horizontal","redisServerUrl": 
    "<redis_server_url>",
    .......
    }

     

  2. 구성 파일을 저장하고 Collaboration Server를 다시 시작하십시오.
  3. 개별 /status URL을 방문하여 모든 Collaboration 서버가 제대로 실행되고 있는지 확인하세요. Collaboration 서버 인스턴스의 실제 상태를 알려줍니다. 예를 들어 아래 Collaboration 서버는 Postgres 및 Redis 서버에 연결할 수 없어 실제로 일시 중지되었습니다.

    복사
    {
    "version":"11.0.0.720",
    "enableTls":false,
    "scaling":"horizontal",
    "logging":true,
    "state":"paused",
    "reason":"The following dependent services are unavailable: DB Service, Redis Server",
    "main":
    {
    "cpu":{"current":0,"max":17},
    "memory":{"current":62758912,"max":85626880},
    "connections":{"total":12,"current":4,"max":11},
    "messages":{"processed":5},
    "restCalls":{"received":3},
    "up_since":"2018-4-18 02:12:42","pid":900
    }
    }

     

웹 로드 밸런서 서버 구성

로드 밸런서는 "고정 세션"을 활용하여 클라이언트가 초기 세션을 설정한 인스턴스로 연결되도록 해야 합니다. 또한 HTTP 1.1 업그레이드 프로토콜에 의존하는 웹 소켓 프로토콜(wss:)도 지원해야 합니다.

예를 들어, 다음은 NGINX를 웹 로드 밸런서로 사용할 때 수평으로 클러스터된 협업 서버에 대한 구성입니다.

복사
......

http {
    ......

    upstream collabServer {
    ip_hash;             # this is a must, ensures that we are sticky to the IP to enable a correct socket.io handshake
    server collabServer1:3000;    # provide the list of the Collaboration servers from here
    server collabServer2:3000;
    server collabServer3:3000;
    }
    
    location /socket.io/ {                    # API Pattern for socket.io handshake
        proxy_http_version 1.1;                # Required for proper HTTP upgrade protocol
        proxy_set_header Upgrade $http_upgrade;     # This is a Hop-by-Hop header–must pass through manually
        proxy_set_header Connection "upgrade";      # Another hop-by-hop header
        proxy_pass http://collabServer/socket.io/;      # Directs the request to a server in upstream "collabServer"
    }

    location /status {                    # forward the /status API to one server from the CollabServer list
        proxy_pass http://collabServer/status;
    }

    ......

}

......