分享

Keystone 高可靠性部署与性能测试

徐超 发表于 2015-1-27 20:22:14 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 0 19788
本帖最后由 徐超 于 2015-1-27 20:26 编辑

问题导读
1、如何理解Keystone 高可靠性?
2、怎样实现Keystone 高可靠性?
3、Keystone 高可靠性有哪些重要概念?




Goal

     Keystone Region 为跨地域的 Openstack 集群提供了统一的认证和用户租户管理。目前公司在国内外部署了数十套 Openstack 集群,其中既有集群在内网,又有集群在公网;既有 Havana 集群,也有 Icehouse 集群;既有 nova-network 集群,又有 Neutron 集群,如下图:
1.png

    为了集中管理,全局共享一个 Keystone Server, 因此对 Keystone Server 的安全性、兼容性以及性能,都有特殊的要求。
2.png

    安全性通过 SSL 实现和防止 DDOS 实现, tempest 测试表明 Keystone 具有很高的向后兼容性,可靠性通过 Apache、Haproxy、mysqlcluster 实现(关于 openstack 整体 HA 的实现,可以参考  http://blog.csdn.net/wsfdl/article/details/41386155),如下图:

1.png

Deployment
物理主机信息
Host Name            IP                         VIP/DNS                                 CPU                                        Memory
keystone01            internal_ip01        public_ip/keystone-server       E5-2620(24 Processor)          64G
keystone02            internal_ip02        public_ip/keystone-server       E5-2620(24 Processor)          64G

说明:若无注明,keystone01 和 keystone02 的部署与配置相同
  1. # yum   -y   install   mysql mysql-server MySQL-python
  2. # yum   -y   install   openstack-keystone python-keystoneclient
  3. # yum   -y   install   haproxy
  4. # yum   -y   install   httpd
  5. # yum   -y   install   keepalived
  6. # yum   -y   install   haproxy
  7. # yum   -y   install   httpd
  8. # yum   -y   install   keepalived
复制代码

Configuration
/etc/keystone/keystone.conf
  1. [DEFAULT]
  2. public_endpoint=https://keystone-server/main/
  3. admin_endpoint=https://keystone-server/admin/
  4. [database]
  5. connection=mysql://keystone:keystonepass@mysqlserver/keystone
  6. max_pool_size=500
  7. [signing]
  8. token_format=UUID
  9. [ssl]
  10. cert_subject=/C=US/ST=Unset/L=Unset/O=Unset/CN=keystone-server
  11. [token]
  12. provider=keystone.token.providers.uuid.Provider
复制代码

/etc/httpd/conf.d/wsgi-keystone.conf
  1. NameVirtualHost *:5000
  2. Listen internal_ip0x:5000
  3. <VirtualHost *:5000>
  4. ServerName keystone-main
  5. WSGIScriptAlias /main  /var/www/cgi-bin/keystone/main
  6. ErrorLog /var/log/keystone/apache2-main-error.log
  7. LogLevel debug
  8. CustomLog /var/log/keystone/apache2-main-access.log common
  9. </VirtualHost>
  10. NameVirtualHost *:35357
  11. Listen internal_ip0x:35357
  12. <VirtualHost *:35357>
  13. ServerName keystone-admin
  14. WSGIScriptAlias /admin  /var/www/cgi-bin/keystone/admin
  15. ErrorLog /var/log/keystone/apache2-admin-error.log
  16. LogLevel debug
  17. CustomLog /var/log/keystone/apache2-admin-access.log common
  18. </VirtualHost>
复制代码

/etc/haproxy/haproxy.cfg
  1. global
  2.     daemon
  3.     log 127.0.0.1 local3
  4. defaults
  5.     maxconn 4000
  6.     log     global
  7.     timeout server 10s
  8.     timeout connect 10s
  9.     timeout client 10s
  10.     mode http
  11.     option forwardfor
  12.     option http-server-close
  13.     log global
  14. listen stats
  15.     mode http
  16.     bind public_ip:8000
  17.     stats enable
  18.     stats hide-version
  19.     stats uri     /
  20.     stats realm   Haproxy\ Statistics
  21.     stats auth    lecloud:openstack
  22.     stats admin if TRUE
  23. frontend keystone_frontend
  24.     bind public_ip:443 ssl crt /etc/haproxy/keystone_https.pem
  25.     reqadd X-Forwarded-Proto:\ https
  26.     acl admin_path path_beg  /admin
  27.     acl main_path  path_beg  /main
  28.     use_backend admin_backend if admin_path
  29.     use_backend main_backend if main_path
  30. backend admin_backend
  31.     balance roundrobin
  32.     redirect scheme https if !{ ssl_fc }
  33.     server keystone-server-01 internal_ip01:35357 check inter 10s
  34.     server keystone-server-02 internal_ip02:35357 check inter 10s
  35. backend main_backend
  36.     balance roundrobin
  37.     redirect scheme https if !{ ssl_fc }
  38.     server keystone-server-01 internal_ip01:5000 check inter 10s
  39.     server keystone-server-02 internal_ip02:5000 check inter 10s
复制代码

/etc/keepalived/keepalived.conf
  1. vrrp_script haproxy-check {
  2.     script "killall -0 haproxy"
  3.     interval 2
  4.     weight 10
  5. }
  6. vrrp_instance openstack-vip {
  7.     state MASTER               # 注:keystone01 为 MASTER, keystone02 为 BACKUP
  8.     priority 102
  9.     interface eth0
  10.     virtual_router_id 108
  11.     advert_int 3
  12.     virtual_ipaddress {
  13.         public_ip
  14.     }
  15.     track_script {
  16.         haproxy-check
  17.     }
  18. }
复制代码


  1. # mkdir   /var/www/cgi-bin/keystone/
  2. # cp   /usr/share/keystone/keystone.wsgi   /var/www/cgi-bin/keystone/
  3. # ln   -s   /var/www/cgi-bin/keystone/keystone.wsgi   /var/www/cgi-bin/keystone/admin
  4. # ln   -s   /var/www/cgi-bin/keystone/keystone.wsgi   /var/www/cgi-bin/keystone/main
  5. # service   httpd   start
  6. # chkconfig   httpd   on
  7. # keystone-manage   ssl_setup   --keystone-user   keystone   --keystone-group   keystone                     注:keystone01
  8. # cat  /etc/keystone/ssl/certs/keystone.pem   /etc/keystone/ssl/private/keystonekey.pem   >   /etc/haproxy/keystone_https.pem              注:keystone01,同时把 keystone_https.pem 拷贝至 keystone02 /etc/haproxy/ 目录下
  9. # (crontab   -l   -u   keystone   2>&1 | grep   -q   token_flush)   ||   echo '@dayly   /usr/bin/keystone-manage   token_flush >/var/log/keystone/keystone-tokenflush.log   2>&1'   >>   /var/spool/cron/keystone
  10. # echo   "net.ipv4.ip_nonlocal_bind = 1"   >>   /etc/sysctl.conf
  11. # sysctl   -p
  12. # service   haproxy   start
  13. # chkconfig   haproxy   on
  14. # service   keepalived   start
  15. # chkconfig   keepalived   on
复制代码

Benchmark

Configure Rally
关于 Rally,详情请参见  Openstack 性能测试 http://blog.csdn.net/wsfdl/article/details/41654373
  1. # git   clone   https://git.openstack.org/stackforge/rally   &&   cd   rally
  2. # ./rally/install_rally.sh   -v
  3. # source   /opt/rally/bin/activate
  4. #  rally   deployment   create   --filename=existing.json   --name=existing
  5. #  rally   -v   task   start   create-user.json
复制代码
  1. (rally)[root@controller rally]# cat existing.json  
  2. {  
  3.     "type": "ExistingCloud",  
  4.     "auth_url": "https://keystone-server/admin/v2.0",  
  5.     "admin": {  
  6.         "username": "test",  
  7.         "password": "test",  
  8.         "tenant_name": "test"  
  9.     }  
  10. }  
复制代码


create-user.json
  1. {  
  2.     "KeystoneBasic.create_user": [  
  3.         {  
  4.             "args": {  
  5.                 "name_length": 10  
  6.             },  
  7.             "runner": {  
  8.                 "type": "constant",  
  9.                 "times": 10000,  
  10.                 "concurrency": 900  
  11.             }  
  12.         }  
  13.     ]  
  14. }   
复制代码

Result
注:以创建用户为例,一个并发数(Concurrency),包含两个 HTTPS 请求(一个为申请 token,另一个为创建用户)。此处仅给出 mysql(单点) 数据库下keystone server 的并发性能。
1.png 1.png




本文转载自:http://blog.csdn.net/wsfdl/article/details/41733295

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条