Centos 7 安装 OpenStack senlin服务(P
2018-11-06 本文已影响3人
Murray66
在centos7上安装OpenStack的Pike版本senlin服务,前排提醒,别照着官网文档装,已经踩坑了,跟着下面步骤装吧
Step 1 创建数据库
登录数据库
mysql -u root -p
创建senlin数据库
CREATE DATABASE senlin DEFAULT CHARACTER SET utf8;
授权(替换 SENLIN_DBPASS
为你的密码)
GRANT ALL ON senlin.* TO 'senlin'@'localhost' \
IDENTIFIED BY 'SENLIN_DBPASS';
GRANT ALL ON senlin.* TO 'senlin'@'%' \
IDENTIFIED BY 'SENLIN_DBPASS';
退出
exit;
Step 2 创建 senlin 用户
导入环境变量
. admin-openrc
创建用户,需输入两次密码
openstack user create --domain default --password service_pass senlin
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8224c672931c481ab7aa5e3351680fe9 |
| name | senlin |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
Step 3 设置管理员角色
openstack role add --project service --user senlin admin
Step 4 创建 senlin 服务
openstack service create --name senlin --description "Senlin Clustering Service V1" clustering
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Senlin Clustering Service V1 |
| enabled | True |
| id | 61df265091bf410e8b4bfaf20c9fa251 |
| name | senlin |
| type | clustering |
+-------------+----------------------------------+
Step 5 创建 API 终端
替换 controllerv
为你的控制节点hostname或ip
openstack endpoint create --region RegionOne senlin public http://controllerv:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 1b633ee2d20c4da89898be50b789511b |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61df265091bf410e8b4bfaf20c9fa251 |
| service_name | senlin |
| service_type | clustering |
| url | http://controllerv:8777 |
+--------------+----------------------------------+
openstack endpoint create --region RegionOne senlin admin http://controllerv:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 3b057edaf85b4a0285ee01aec61af06d |
| interface | admin |
stats enable
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61df265091bf410e8b4bfaf20c9fa251 |
| service_name | senlin |
| service_type | clustering |
| url | http://controllerv:8777 |
+--------------+----------------------------------+
openstack endpoint create --region RegionOne senlin internal http://controllerv:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 761997f4a504466e808bccf1d30b1b96 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61df265091bf410e8b4bfaf20c9fa251 |
| service_name | senlin |
| service_type | clustering |
| url | http://controllerv:8777 |
+--------------+----------------------------------+
注意,端口是8777,不是8778
Step 6 安装 senlin 软件包
yum install openstack-senlin-engine.noarch \
openstack-senlin-api.noarch openstack-senlin-common.noarch \
python2-senlinclient.noarch
Step 7 修改配置文件
重点来了
这里面 controller
部分填写你控制节点的 hostname
或 ip
SENLIN_DBPASS
填写之前数据库设的密码
vim /etc/senlin/senlin.conf
[DEFAULT]
transport_url = rabbit://openstack:rabbit@controller
default_region_name = RegionOne
debug = True
[senlin_api]
bind_host = 本机ip #或者填写0.0.0.0
bind_port = 8777
[database]
connection = mysql+pymysql://senlinUser:SENLIN_DBPASS@contoller/senlin
[authentication]
auth_url = http://controller:5000
service_username = senlin
service_password = service_pass
service_project_name = service
[keystone_authtoken]
auth_uri = http://controller:5000
auth_version = 3
identity_uri = http://controller:35357
admin_user = senlin
admin_password = service_pass
admin_tenant_name = service
特别注意bind_port
, 在senlin的源码文件 /usr/lib/python2.7/site-packages/senlin/api/common/wsgi.py
中,默认的端口是8778:
而我们创建终端的端口明明是8777,所以要在配置文件中添加 bind_port = 8777
,不然可能造成如下一些错误:
Unable to establish connection to http://controller:8777: ('Connection aborted.', BadStatusLine("''",))
Step 8 同步数据库
su -s /bin/sh -c "senlin-manage db_sync" senlin
Step 9 开启 senlin 服务
systemctl enable openstack-senlin-api.service openstack-senlin-engine.service
systemctl start openstack-senlin-api.service openstack-senlin-engine.service
Step 10 验证安装
. admin-openrc
openstack cluster service list
+---------------+-------------+---------+-------+---------------------+-----------------+
| binary | host | status | state | updated_at | disabled_reason |
+---------------+-------------+---------+-------+---------------------+-----------------+
| senlin-engine | controller1 | enabled | up | 2018-11-06T07:47:30 | None |
+---------------+-------------+---------+-------+---------------------+-----------------+
openstack cluster build info
+--------+---------------------+
| Field | Value |
+--------+---------------------+
| api | { |
| | "revision": "1.0" |
| | } |
| engine | { |
| | "revision": "1.0" |
| | } |
+--------+---------------------+
终于成功了,也是长舒了一口气
参考链接:
https://openstackschool.blogspot.com/2018/03/install-and-configure-openstack-senlin.html
https://docs.openstack.org/senlin/rocky/install/install-rdo.html