次のスキームが登場しました。
- マスターvrrpノードは、http(s)を介してデータストリームを受信します。
- gobetweenはすべてのトラフィックを自身に分散し、vrrpノードをバックアップします。
- 次に、radosgwはcephに直接書き込みます。
- vrrpマスターノードが落ちた場合、マスターが立ち上がるまでバックアップノードはそれ自体のすべての負荷を引き受けます
以下のこのアクションの実装をお読みください。
与えられた:
- Ceph Cluster(ジュエル)
- IPモニター:10.0.1.1、10.0.1.2、10.0.1.3
- 2台のアイロンサーバー(CentOS)
- 最初のサーバーは10.0.0.1です(gbt1.example.comと呼びましょう)。
- 2番目のサーバー10.0.0.2(gbt2.example.com)
- 共有IPは10.0.0.3(s3.example.com)になります
- ドメインexample.com
チャレンジ:
RadosGWで編成されたS3ストレージのフェールオーバーバランシングを行う
ステージ:
- RadosGWを2つのサーバーに展開する
- VRRPでフォールトトレランスを整理する
- GoBetweenを使用してS3トラフィックバランシングを整理する
- 確認する
準備(すべてが両方のマシンで同一)
CentOS 7.4がサーバーにインストールされます。OSをインストールしたらすぐにすべてを更新します。
# yum -y update
ToRに必要なすべてのソフトウェアをインストールします(最初にリポジトリのみがインストールされるため、cefを除く)。
# yum -y install keepalived centos-release-ceph-jewel wget
現時点では、まだCephをインストールしていないため、インストールします。
# yum -y install ceph-radosgw
必要なポートを開き、サービスを有効にして、ファイアウォールをすぐに構成します。
# firewall-cmd --permanent --add-port=18080/tcp # firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 --in-interface enp2s0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT # firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 --out-interface enp2s0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT # firewall-cmd --permanent --add-port=10050/tcp # firewall-cmd --reload
SELinuxをオフにします(念のため):
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux # setenforce 0
RadosGWを展開する
最初は、Cephクラスターは既に提起されています。ここでは詳細に触れません。トピックはこの記事ではなく、radosGWの構成にすぐに進みます。
構成は例として示されています。あなたの場合、いくつかのパラメーターは異なるかもしれません:
# cat /etc/ceph/ceph.conf [global] fsid = 01dea7f3-91f4-48d1-9d44-ba93d4a103c5 mon_host = 10.0.1.1, 10.0.1.2, 10.0.1.3 auth_cluster_required = cephx auth_service_required = cephx auth_client_required = cephx public_network = 10.0.1.0/24 [client] rbd_cache = true [client.radosgw.gateway] rgw_frontends = civetweb port=18080 rgw_region = example rgw_region_root_pool = .example.rgw.root rgw_zone = example-s3 rgw_zone_root_pool = .example-s3.rgw.root host = s3 keyring = /etc/ceph/client.radosgw.gateway rgw_dns_name = s3.example.com rgw_print_continue = true
Cephクラスターの任意のノードから/etc/ceph/client.radosgw.gatewayキーをコピーすることを忘れないでください
radosgwを実行します。
# systemctl start ceph-radosgw@radosgw.gateway
そして、自動開始に追加します:
# systemctl enable ceph-radosgw@radosgw.gateway
VRRPを展開する
マスターノード上(状態と優先度のオプションの違い):
# cat /etc/keepalived/keepalived.conf global_defs { notification_email { user@example.com } notification_email_from gbt@example.com smtp_server mail.example.com smtp_connect_timeout 30 router_id GBT1 } vrrp_instance VI_1 { state MASTER interface enp2s0 virtual_router_id 33 priority 101 advert_int 1 smtp_alert authentication { auth_type PASS auth_pass 123123123 } virtual_ipaddress { 10.0.0.3 } }
バックアップに関するメモ:
# cat /etc/keepalived/keepalived.conf global_defs { notification_email { user@example.com } notification_email_from gbt@example.com smtp_server mail.example.com smtp_connect_timeout 30 router_id GBT1 } vrrp_instance VI_1 { state BACKUP interface enp2s0 virtual_router_id 33 priority 100 advert_int 1 smtp_alert authentication { auth_type PASS auth_pass 123123123 } virtual_ipaddress { 10.0.0.3 } }
再起動して自動起動に追加します(両方のノード):
# systemctl restart keepalived # systemctl enable keepalived
GoBetweenを展開
開始するには、gobetweenバイナリをダウンロードして解凍します。
# wget https://github.com/yyyar/gobetween/releases/download/0.5.0/gobetween_0.5.0_linux_amd64.tar.gz # tar -xzf gobetween_0.5.0_linux_amd64.tar.gz -C /usr/local/bin/
gobetween configを記述します(SSL接続の場合、キーの場所を示します)。 両方のノードの構成は同じです:
# cat /etc/gobetween.toml [logging] level = "debug" # "debug" | "info" | "warn" | "error" output = "/var/log/gobetween.log" [api] enabled = true # true | false bind = ":8888" # "host:port" cors = false # cross-origin resource sharing [defaults] max_connections = 0 # Maximum simultaneous connections to the server client_idle_timeout = "0" # Client inactivity duration before forced connection drop backend_idle_timeout = "0" # Backend inactivity duration before forced connection drop backend_connection_timeout = "0" # Backend connection timeout (ignored in udp) [servers] [servers.sample] protocol = "tls" bind = "0.0.0.0:443" balance = "roundrobin" [servers.sample.discovery] kind = "static" static_list = [ "10.0.0.1:18080 weight=1", "10.0.0.2:18080 weight=1" ] [servers.sample.tls] root_ca_cert_path = "/etc/exampleSSC-CA.crt" cert_path = "/etc/s3.example.com.crt" key_path = "/etc/s3.example.com.key" [servers.sample.healthcheck] fails = 1 passes = 1 interval = "2s" timeout="1s" kind = "ping" ping_timeout_duration = "500ms" [servers.sample2] protocol = "tcp" bind = "0.0.0.0:80" balance = "roundrobin" [servers.sample2.discovery] kind = "static" static_list = [ "10.0.0.1:18080 weight=1", "10.0.0.2:18080 weight=1" ] [servers.sample2.healthcheck] fails = 1 passes = 1 interval = "2s" timeout="1s" kind = "ping" ping_timeout_duration = "500ms"
Gobetweenは次のコマンドで起動します(便利な方法で自動起動に追加します):
# /usr/local/bin/gobetween -c /etc/gobetween.toml
確認する
検証には、たとえばs3cmdやDragonDiskなど、任意のS3クライアントを使用できます。 s3cmdの検証オプションは次のようになります(s3.example.comが既に構成でサーバーとして指定されていることを考慮して)。
# s3cmd ls
少なくともいくつかのバケットがすでにある場合、彼の名前は排気口にあります;バケットがない場合、空の排気口があります。
現在の外観-下の画面で確認できます。 1日あたりの統計(1秒あたりのギガバイト単位のグラフ):

まとめ
負荷は大幅に減少し、鈍いものはなく、すべてのバックアップが一晩で集まる時間があります(それ以前は、営業日の高さで、まだ組み立てることができました)。
このhautushkaがradosgwの負荷を加速および軽減するのに役立つことを願っています