메시징 서비스 설치 ( zaqar ) 2. 설치 및 구성 > OpenStack 자료실

본문 바로가기
사이트 내 전체검색

OpenStack 자료실

메시징 서비스 설치 ( zaqar ) 2. 설치 및 구성

페이지 정보

profile_image
작성자 jkchoi
댓글 0건 조회 4,261회 작성일 21-10-28 09:52

본문

웹 서버 WEB0.EXAMPLE-MESSAGES.NET에 memcached, uWSGI 및 Messaging을 설치하고 구성합니다.


1. ID 서비스 토큰 및 카탈로그 매핑을 캐시하려면 웹 서버 WEB0.EXAMPLE-MESSAGES.NET에 memcached를 설치합니다.

      # yum install memcached

  1) memcached서비스 시작

      # systemctl start memcached

  2) memcached서비스를 재부팅 후 자동으로 시작

      # systemctl enable memcached


2. 메시징 서비스 및 uWSGI 설치

      # yum -y install python-pip
      # git clone https://git.openstack.org/openstack/zaqar.git
      # cd zaqar
      # pip install . -r ./requirements.txt --upgrade --log /tmp/zaqar-pip.log
      # pip install --upgrade pymongo gevent uwsgi


3. Zaqar RBAC 정책 샘플 파일을 etc/zaqar/ 디렉토리에 복사합니다.

      # mkdir
      # cp etc/policy.json.sample /etc/zaqar/policy.json


4. 로그 파일 생성

      # touch /var/log/zaqar-server.log
      # chown ZAQARUSER:ZAQARUSER /var/log/zaqar-server.log
      # chmod 600 /var/log/zaqar-server.log

      - ZAQARUSER를 메시징 서비스가 실행될 시스템의 사용자 이름으로 바꿉니다.


5. uWSGI 구성 파일을 저장할 /srv/zaqar 폴더를 만듭니다.


6. 다음 내용으로 /srv/zaqar/zaqar_uwsgi.py를 만듭니다.

      from keystonemiddleware import auth_token
      from zaqar.transport.wsgi import app

      app = auth_token.AuthProtocol(app.app, {})


7. 백로그 수신 제한을 기본값(128)에서 늘리십시오.

      # echo "net.core.somaxconn=2048" | sudo tee --append /etc/sysctl.conf


8. 다음 내용으로 /srv/zaqar/uwsgi.ini 파일을 만들고 필요에 따라 수정합니다.

      [uwsgi]
      https = WEB0.EXAMPLE-MESSAGES.NET:8888,PATH_TO_SERVER_CRT,PATH_TO_SERVER_PRIVATE_KEY
      pidfile = /var/run/zaqar.pid
      gevent = 2000
      gevent-monkey-patch = true
      listen = 1024
      enable-threads = true
      module = zaqar_uwsgi:app
      workers = 4
      harakiri = 60
      add-header = Connection: close

      - PATH_TO_SERVER_CRT를 서버의 인증서 경로(*.crt)로, PATH_TO_SERVER_PRIVATE_KEY를 서버의 개인 키(*.key) 경로로 바꿉니다.

      - 위의 uWSGI 구성 옵션은 로드 밸런싱을 포함한 다양한 보안 및 성능 요구 사항에 맞게 수정할 수 있습니다. 공식 uWSGI 구성 참조를 참조하십시오.



9. 다음 내용으로 메시징 서비스의 구성 파일 /etc/zaqar.conf를 만듭니다.

      [DEFAULT]
      # Show debugging output in logs (sets DEBUG log level output)
      #debug = False

      # Pooling and admin mode configs
      pooling      = True
      admin_mode    = True

      # Log to file
      log_file = /var/log/zaqar-server.log

      # This is taken care of in our custom app.py, so disable here
      ;auth_strategy = keystone

      # Modify to make it work with your Identity service.
      [keystone_authtoken]
      project_domain_name = Default
      user_domain_name = Default
      project_domain_id = default
      project_name = service
      user_domain_id = default
      # File path to a PEM encoded Certificate Authority to use when verifying
      # HTTPs connections. Defaults to system CAs if commented.
      cafile = PATH_TO_CA_FILE
      # Messaging service user name in Identity service.
      username = ZAQARIDENTITYUSER
      # Messaging service password in Identity service.
      password = ZAQARIDENTITYPASSWORD
      # Complete public Identity API endpoint (HTTPS protocol is more preferable
      # than HTTP).
      auth_uri = HTTPS://IDENTITY.EXAMPLE-MESSAGES.NET:5000
      # Complete admin Identity API endpoint (HTTPS protocol is more preferable
      # than HTTP).
      auth_url = HTTPS://IDENTITY.EXAMPLE-MESSAGES.NET:35357
      # Token cache time in seconds.
      token_cache_time = TOKEN_CACHE_TIME
      memcached_servers = 127.0.0.1:11211

      [cache]
      # Dogpile.cache backend module. It is recommended that Memcache with
      # pooling (oslo_cache.memcache_pool) or Redis (dogpile.cache.redis) be
      # used in production deployments. Small workloads (single process)
      # like devstack can use the dogpile.cache.memory backend. (string
      # value)
      backend = dogpile.cache.memory
      memcache_servers = 127.0.0.1:11211

      [drivers]
      transport = wsgi
      message_store = mongodb
      management_store = mongodb

      [drivers:management_store:mongodb]
      # Mongodb Connection URI. If ssl connection enabled, then ssl_keyfile,
      # ssl_certfile, ssl_cert_reqs, ssl_ca_certs options need to be set
      # accordingly.
      uri = mongodb://MYDB0.EXAMPLE-MESSAGES.NET,MYDB1.EXAMPLE-MESSAGES.NET,MYDB2.EXAMPLE-MESSAGES.NET:27017/?replicaSet=catalog&w=2&readPreference=secondaryPreferred

      # Name for the database on mongodb server.
      database = zaqarmanagementstore

      # Number of databases across which to partition message data, in order
      # to reduce writer lock %. DO NOT change this setting after initial
      # deployment. It MUST remain static. Also, you should not need a large
      # number of partitions to improve performance, esp. if deploying
      # MongoDB on SSD storage. (integer value)
      partitions = 8

      # Uncomment any options below if needed.

      # Maximum number of times to retry a failed operation. Currently
      # only used for retrying a message post.
      ;max_attempts = 1000

      # Maximum sleep interval between retries (actual sleep time
      # increases linearly according to number of attempts performed).
      ;max_retry_sleep = 0.1

      # Maximum jitter interval, to be added to the sleep interval, in
      # order to decrease probability that parallel requests will retry
      # at the same instant.
      ;max_retry_jitter = 0.005

      # Frequency of message garbage collections, in seconds
      ;gc_interval = 5 * 60

      # Threshold of number of expired messages to reach in a given
      # queue, before performing the GC. Useful for reducing frequent
      # locks on the DB for non-busy queues, or for worker queues
      # which process jobs quickly enough to keep the number of in-
      # flight messages low.
      #
      # Note: The higher this number, the larger the memory-mapped DB
      # files will be.
      ;gc_threshold = 1000

      [drivers:message_store:mongodb]
      # This section has same set of available options as
      # "[drivers:management_store:mongodb]" section.
      #
      # If pooling is enabled, all pools inherit values from options in these
      # settings unless overridden in pool creation request. Also "uri" option
      # value isn't used in case of pooling.
      #
      # If ssl connection enabled, then ssl_keyfile, ssl_certfile, ssl_cert_reqs,
      # ssl_ca_certs options need to be set accordingly.

      # Name for the database on MondoDB server.
      database = zaqarmessagestore

      [transport]
      max_queues_per_page = 1000
      max_queue_metadata = 262144
      max_mesages_per_page = 10
      max_messages_post_size = 262144
      max_message_ttl = 1209600
      max_claim_ttl = 43200
      max_claim_grace = 43200

      [signed_url]
      # Secret key used to encrypt pre-signed URLs. (string value)
      secret_key = SOMELONGSECRETKEY

      - 필요에 따라 옵션, 특히 대문자 값이 있는 옵션을 편집하십시오.


10. 메시징 서비스 /etc/systemd/system/zaqaruwsgi.service에 대한 서비스 파일을 만듭니다.

      [Unit]
      Description=uWSGI Zaqar
      After=syslog.target

      [Service]
      ExecStart=/usr/bin/uwsgi --ini /srv/zaqar/uwsgi.ini
      # Requires systemd version 211 or newer
      RuntimeDirectory=uwsgi
      Restart=always
      KillSignal=SIGQUIT
      Type=notify
      StandardError=syslog
      NotifyAccess=all
      User=ZAQARUSER
      Group=ZAQARUSER

      [Install]
      WantedBy=multi-user.target

      - ZAQARUSER메시징 서비스가 실행될 시스템의 사용자 이름으로 바꿉니다 .



설치 완료

이제 웹 서버와 데이터베이스 서버가 기능하는 Messaging 서비스를 구성한 후 서비스를 시작하고 서비스가 시스템과 함께 자동으로 시작되도록 하고 생성된 MongoDB 복제본 집합을 Messaging의 풀로 정의해야 합니다.


1. 웹 서버에서 메시징 서비스 시작

      # systemctl start zaqar.uwsgi.service


2. 웹 서버에서 재부팅 후 메시징 서비스가 자동으로 시작되도록 합니다.

      # systemctl enable zaqar.uwsgi.service


3. 풀 구성

      # curl -i -X PUT https://WEB0.EXAMPLE-MESSAGES.NET:8888/v2/pools/POOL1 \
                -d '{"weight": 100, "uri": "mongodb://MYDB0.EXAMPLE-MESSAGES.NET,MYDB1.EXAMPLE-MESSAGES.NET,MYDB2.EXAMPLE-MESSAGES.NET:27017/?replicaSet=catalog&w=2&readPreference=secondaryPreferred", "options": {"partitions": 8}}' \
                -H "Client-ID: CLIENT_ID" \
                -H "X-Auth-Token: TOKEN" \
                -H "Content-type: application/json" \

      - POOL1변수를 원하는 풀 이름으로 바꿉니다.

      - CLIENT_ID변수를 예를 들어 uuidgen 유틸리티에서 생성할 수 있는 UUID(Universally Unique Identifier)로 바꿉니다.

      - TOKEN변수를 ID 서비스에서 검색된 인증 토큰으로 바꿉니다 . Keystone 인증을 활성화하지 않도록 선택하면 토큰을 전달할 필요가 없습니다.

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

접속자집계

오늘
404
어제
1,290
최대
3,935
전체
800,119
Copyright © www.linuxdata.org All rights reserved.