OpenStack版本升级之Keystone

下载新版本并备份相关文件及数据

前面已经比较过Keystone在E版和F版中的一些差异,现在该是升级的时候了。原Keystone的Essex版本是在CentOS6.2下通过源代码安装的,后面在epel的rpm安装包找了个init脚本,使得Keystone能通过service管理并在开机时自动运行,因此这里仍然通过源代码进行升级。以防万一,首先要备份相关旧版的文件、数据,要备份的文件主要包括/usr/bin下的三个文件,/etc/keystone下的所有配置文件以及数据库keystone,命令如下所示:

[plain]  view plain copy
  1. [root@stackcc update_keystone]# wget https://launchpad.net/keystone/folsom/2012.2/+download/keystone-2012.2.tar.gz  
  2. [root@stackcc update_keystone]# mkdir -p backup/bin  
  3. [root@stackcc update_keystone]# cp /usr/bin/keystone* backup/bin/  
  4. [root@stackcc update_keystone]# mkdir backup/etc  
  5. [root@stackcc update_keystone]# cp /etc/keystone/* backup/etc/  
  6. [root@stackcc update_keystone]# mysqldump -ukeystone -p keystone > backup/keystone.sql  

停止Keystone服务并安装F版Keystone

[plain]  view plain copy
  1. [root@stackcc update_keystone]# service keystone stop  
  2. [root@stackcc update_keystone]# tar -zxf keystone-2012.2.tar.gz   
  3. [root@stackcc update_keystone]# cd keystone-2012.2  
  4. [root@stackcc keystone-2012.2]# python setup.py install > keystone.info  

配置F版Keystone

主要修改了admin_token、log选项、sql选项、token和ec2选项,如下所示:

[plain]  view plain copy
  1. [root@stackcc keystone-2012.2]# rm -fr /etc/keystone/*  
  2. [root@stackcc keystone-2012.2]# cp etc/* /etc/keystone/  
  3. [root@stackcc keystone-2012.2]# ll /etc/keystone/  
  4. total 20  
  5. -rw-r--r-- 1 root root 1539 Nov  4 19:42 default_catalog.templates  
  6. -rw-r--r-- 1 root root 5753 Nov  4 19:42 keystone.conf.sample  
  7. -rw-r--r-- 1 root root  758 Nov  4 19:42 logging.conf.sample  
  8. -rw-r--r-- 1 root root   59 Nov  4 19:42 policy.json  
  9. [root@stackcc keystone-2012.2]# mv /etc/keystone/keystone.conf.sample /etc/keystone/keystone.conf  
  10. [root@stackcc keystone-2012.2]# mv /etc/keystone/logging.conf.sample /etc/keystone/logging.conf  
  11. [root@stackcc keystone-2012.2]# cat /etc/keystone/keystone.conf   
  12. [DEFAULT]  
  13. # A "shared secret" between keystone and other openstack services  
  14. admin_token = 7d97448231c0a2bac8a3  
  15.   
  16. # The IP address of the network interface to listen on  
  17. # bind_host = 0.0.0.0  
  18.   
  19. # The port number which the public service listens on  
  20. # public_port = 5000  
  21.   
  22. # The port number which the public admin listens on  
  23. # admin_port = 35357  
  24.   
  25. # The port number which the OpenStack Compute service listens on  
  26. # compute_port = 8774  
  27.   
  28. # === Logging Options ===  
  29. # Print debugging output  
  30. # verbose = False  
  31.   
  32. # Print more verbose output  
  33. # (includes plaintext request logging, potentially including passwords)  
  34. # debug = False  
  35.   
  36. # Name of log file to output to. If not set, logging will go to stdout.  
  37. log_file = keystone.log  
  38.   
  39. # The directory to keep log files in (will be prepended to --logfile)  
  40. log_dir = /var/log/keystone  
  41.   
  42. # Use syslog for logging.  
  43. # use_syslog = False  
  44.   
  45. # syslog facility to receive log lines  
  46. # syslog_log_facility = LOG_USER  
  47.   
  48. # If this option is specified, the logging configuration file specified is  
  49. # used and overrides any other logging options specified. Please see the  
  50. # Python logging module documentation for details on logging configuration  
  51. # files.  
  52. # log_config = logging.conf  
  53.   
  54. # A logging.Formatter log message format string which may use any of the  
  55. # available logging.LogRecord attributes.  
  56. # log_format = %(asctime)s %(levelname)8s [%(name)s] %(message)s  
  57.   
  58. # Format string for %(asctime)s in log records.  
  59. # log_date_format = %Y-%m-%d %H:%M:%S  
  60.   
  61. # onready allows you to send a notification when the process is ready to serve  
  62. # For example, to have it notify using systemd, one could set shell command:  
  63. # onready = systemd-notify --ready  
  64. # or a module with notify() method:  
  65. # onready = keystone.common.systemd  
  66.   
  67. [sql]  
  68. # The SQLAlchemy connection string used to connect to the database  
  69. connection = mysql://keystone:keystone@localhost/keystone  
  70.   
  71. # the timeout before idle sql connections are reaped  
  72. # idle_timeout = 200  
  73.   
  74. [identity]  
  75. # driver = keystone.identity.backends.sql.Identity  
  76.   
  77. [catalog]  
  78. # dynamic, sql-based backend (supports API/CLI-based management commands)  
  79. # driver = keystone.catalog.backends.sql.Catalog  
  80.   
  81. # static, file-based backend (does *NOT* support any management commands)  
  82. # driver = keystone.catalog.backends.templated.TemplatedCatalog  
  83.   
  84. # template_file = default_catalog.templates  
  85.   
  86. [token]  
  87. driver = keystone.token.backends.sql.Token  
  88.   
  89. # Amount of time a token should remain valid (in seconds)  
  90. # expiration = 86400  
  91.   
  92. [policy]  
  93. # driver = keystone.policy.backends.rules.Policy  
  94.   
  95. [ec2]  
  96. driver = keystone.contrib.ec2.backends.sql.Ec2  
  97.   
  98. [ssl]  
  99. #enable = True  
  100. #certfile = /etc/keystone/ssl/certs/keystone.pem  
  101. #keyfile = /etc/keystone/ssl/private/keystonekey.pem  
  102. #ca_certs = /etc/keystone/ssl/certs/ca.pem  
  103. #cert_required = True  
  104.   
  105. [signing]  
  106. #token_format = UUID  
  107. #certfile = /etc/keystone/ssl/certs/signing_cert.pem  
  108. #keyfile = /etc/keystone/ssl/private/signing_key.pem  
  109. #ca_certs = /etc/keystone/ssl/certs/ca.pem  
  110. #key_size = 1024  
  111. #valid_days = 3650  
  112. #ca_password = None  
  113. #token_format = PKI  
  114.   
  115. [ldap]  
  116. # url = ldap://localhost  
  117. # user = dc=Manager,dc=example,dc=com  
  118. # password = None  
  119. # suffix = cn=example,cn=com  
  120. # use_dumb_member = False  
  121.   
  122. # user_tree_dn = ou=Users,dc=example,dc=com  
  123. # user_objectclass = inetOrgPerson  
  124. # user_id_attribute = cn  
  125. # user_name_attribute = sn  
  126.   
  127. # tenant_tree_dn = ou=Groups,dc=example,dc=com  
  128. # tenant_objectclass = groupOfNames  
  129. # tenant_id_attribute = cn  
  130. # tenant_member_attribute = member  
  131. # tenant_name_attribute = ou  
  132.   
  133. # role_tree_dn = ou=Roles,dc=example,dc=com  
  134. # role_objectclass = organizationalRole  
  135. # role_id_attribute = cn  
  136. # role_member_attribute = roleOccupant  
  137.   
  138. [filter:debug]  
  139. paste.filter_factory = keystone.common.wsgi:Debug.factory  
  140.   
  141. [filter:token_auth]  
  142. paste.filter_factory = keystone.middleware:TokenAuthMiddleware.factory  
  143.   
  144. [filter:admin_token_auth]  
  145. paste.filter_factory = keystone.middleware:AdminTokenAuthMiddleware.factory  
  146.   
  147. [filter:xml_body]  
  148.   
  149. paste.filter_factory = keystone.middleware:XmlBodyMiddleware.factory  
  150.   
  151. [filter:json_body]  
  152. paste.filter_factory = keystone.middleware:JsonBodyMiddleware.factory  
  153.   
  154. [filter:user_crud_extension]  
  155. paste.filter_factory = keystone.contrib.user_crud:CrudExtension.factory  
  156.   
  157. [filter:crud_extension]  
  158. paste.filter_factory = keystone.contrib.admin_crud:CrudExtension.factory  
  159.   
  160. [filter:ec2_extension]  
  161. paste.filter_factory = keystone.contrib.ec2:Ec2Extension.factory  
  162.   
  163. [filter:s3_extension]  
  164. paste.filter_factory = keystone.contrib.s3:S3Extension.factory  
  165.   
  166. [filter:url_normalize]  
  167. paste.filter_factory = keystone.middleware:NormalizingFilter.factory  
  168.   
  169. [filter:stats_monitoring]  
  170. paste.filter_factory = keystone.contrib.stats:StatsMiddleware.factory  
  171.   
  172. [filter:stats_reporting]  
  173. paste.filter_factory = keystone.contrib.stats:StatsExtension.factory  
  174.   
  175. [app:public_service]  
  176. paste.app_factory = keystone.service:public_app_factory  
  177.   
  178. [app:admin_service]  
  179. paste.app_factory = keystone.service:admin_app_factory  
  180.   
  181. [pipeline:public_api]  
  182. pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug ec2_extension user_crud_extension public_service  
  183.   
  184. [pipeline:admin_api]  
  185. pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug stats_reporting ec2_extension s3_extension crud_extension admin_service  
  186.   
  187. [app:public_version_service]  
  188. paste.app_factory = keystone.service:public_version_app_factory  
  189.   
  190. [app:admin_version_service]  
  191. paste.app_factory = keystone.service:admin_version_app_factory  
  192.   
  193. [pipeline:public_version_api]  
  194. pipeline = stats_monitoring url_normalize xml_body public_version_service  
  195.   
  196. [pipeline:admin_version_api]  
  197. pipeline = stats_monitoring url_normalize xml_body admin_version_service  
  198.   
  199. [composite:main]  
  200. use = egg:Paste#urlmap  
  201. /v2.0 = public_api  
  202. / = public_version_api  
  203.   
  204. [composite:admin]  
  205. use = egg:Paste#urlmap  
  206. /v2.0 = admin_api  
  207. / = admin_version_api  

同步数据库并启动Keystone

[plain]  view plain copy
  1. [root@stackcc keystone-2012.2]# keystone-manage db_sync  
  2. [root@stackcc keystone-2012.2]# chmod 640 /etc/keystone/*  
  3. [root@stackcc keystone-2012.2]# chown -R keystone:keystone /etc/keystone  
  4. [root@stackcc keystone-2012.2]# service keystone start  

验证

[plain]  view plain copy
  1. [root@stackcc keystone-2012.2]# source ~/.openstackrc   
  2. [root@stackcc keystone-2012.2]# keystone user-list  
  3. +----------------------------------+---------+--------------------+--------+  
  4. |                id                | enabled |       email        |  name  |  
  5. +----------------------------------+---------+--------------------+--------+  
  6. | 397dd3be88b6492caa88521502b07617 | True    | sigsit@example.com | sigsit |  
  7. | 4014d8d779c7463e8e7c3253360ff448 | True    | admin@example.com  | admin  |  
  8. | 63e2819834924b39be950d14fcb25120 | True    | nova@example.com   | nova   |  
  9. | 88e6450633c944eca7a1c5bc74b994ce | True    | ugyn@qq.com        | ugyn   |  
  10. | a94110d755f9415b9adb685b43beb093 | True    | glance@example.com | glance |  
  11. | bdfaf996fbdf4e42b3d7898b365a72cb | True    | swift@example.com  | swift  |  
  12. +----------------------------------+---------+--------------------+--------+  
  13. [root@stackcc keystone-2012.2]# keystone tenant-list  
  14. +----------------------------------+---------+---------+  
  15. |                id                |   name  | enabled |  
  16. +----------------------------------+---------+---------+  
  17. | 64498ea937dd411385e13b40dbf43061 | admin   | True    |  
  18. | b61cec3f3a47403e9cfeb49c12af29ab | service | True    |  
  19. | c6159a4f3dd34a2b83527499a40dbd2b | sigsit  | True    |  
  20. +----------------------------------+---------+---------+  
  21. [root@stackcc keystone-2012.2]# keystone service-list  
  22. +----------------------------------+-------------+--------------+---------------------------+  
  23. |                id                |     name    |     type     |        description        |  
  24. +----------------------------------+-------------+--------------+---------------------------+  
  25. | 00217d2721e94cee9f4c27c8c2f89f52 | swift       | object-store | Swift Service             |  
  26. | 0b0ec80909084f6f9ca8e6c880bd9e6a | nova-volume | volume       | Nova Volume Service       |  
  27. | 109991c86f00437aa8d6cb068acc142e | nova        | compute      | Nova Compute Service      |  
  28. | 5ed302eedbfe4635b5af14f81200c826 | ec2         | ec2          | EC2 Compatibility Layer   |  
  29. | 621f008efd9146db8b395eefc078de3f | glance      | image        | Glance Image Service      |  
  30. | 8cda7f68aee6458ca80dd6b13f7cb205 | horizon     | dashboard    | OpenStack Dashboard       |  
  31. | e0ac1fb0b21d4ec5ae8299c8ba3b3fed | keystone    | identity     | Keystone Identity Service |  
  32. +----------------------------------+-------------+--------------+---------------------------+  
  33. [root@stackcc keystone-2012.2]# keystone endpoint-list  
  34. +----------------------------------+-----------+-------------------------------------------------------+-------------------------------------------------------+-------------------------------------------------------+  
  35. |                id                |   region  |                       publicurl                       |                      internalurl                      |                        adminurl                       |  
  36. +----------------------------------+-----------+-------------------------------------------------------+-------------------------------------------------------+-------------------------------------------------------+  
  37. | 7794675fe0d34564a3e36f3a9abf0dde | RegionOne | http://10.61.2.12:8773/services/Cloud                 | http://10.61.2.12:8773/services/Cloud                 | http://10.61.2.12:8773/services/Admin                 |  
  38. | 7e4496ad141343daa1de46fc84bedfa2 | RegionOne | http://10.61.2.12:$(public_port)s/v2.0                | http://10.61.2.12:$(admin_port)s/v2.0                 | http://10.61.2.12:$(admin_port)s/v2.0                 |  
  39. | 945017f40c8d47c8bd3e9adc85d90d79 | RegionOne | http://10.61.2.12:8888/v2/AUTH_$(tenant_id)s          | http://10.61.2.12:8888/v2/AUTH_$(tenant_id)s          | http://10.61.2.12:8888/                               |  
  40. | 9584cc8ab68e40da86d624f62cf29331 | RegionOne | http://10.61.2.12:$(compute_port)s/v1.1/$(tenant_id)s | http://10.61.2.12:$(compute_port)s/v1.1/$(tenant_id)s | http://10.61.2.12:$(compute_port)s/v1.1/$(tenant_id)s |  
  41. | bfb6a52efd3e4bd68dcfd1df51367740 | RegionOne | http://10.61.2.12:8776/v1/$(tenant_id)s               | http://10.61.2.12:8776/v1/$(tenant_id)s               | http://10.61.2.12:8776/v1/$(tenant_id)s               |  
  42. | ef02c9245d3144219b1548bc633061c3 | RegionOne | http://10.61.2.12:9292/v1                             | http://10.61.2.12:9292/v1                             | http://10.61.2.12:9292/v1                             |  
  43. +----------------------------------+-----------+-------------------------------------------------------+-------------------------------------------------------+-------------------------------------------------------+  

最后测试从Horizon登录,创建实例再删除,从Object Store下载一个小文件,上传文件,删除文件均正常。因此Keystone的升级算圆满完成了。接下来考虑Glance的升级。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值