vzdsa 发表于 2015-8-13 10:33:11

openstack部署安装(Icehouse版本)-控制节点(Controller)-基本配置

控制节点(Controller)安装


此次安装,我们将数据库(mysql)安装到控制节点上,不为设置单独的数据库服务器。


2.1 安装数据库(mysql)

# yum install mysql mysql-server MySQL-python -y

修改数据库的配置文件/etc/my.cnf,设置数据库的bing-address,数据库引擎,以及字符集等。


...
bind-address = 10.0.0.11
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8

启动数据库并设置开机自动启动

# service mysqld start
# chkconfig mysqld on

设置数据库的密码
    # mysql_secure_installation
   
PS:在另外两个节点上面安装
    # yum install MySQL-python -y


2.2 Messaging server(qpid)


OpenStack使用消息代理协调服务的操作和状态信息。消息代理服务通常在控制器节点上运行。OpenStack支持多种消息代理包括RabbitMQ,QPID,和ZeroMQ。


我们这里使用qpid

    安装qpid

       # yum install qpid-cpp-server -y
      
为了简化测试环境的安装,我们这里禁用身份验证。编辑/etc/qpidd.conf
    vi /etc/qpidd.conf
   auth=no
   
启动qpid服务,并设置开机自动启动
      # service qpidd start
      # chkconfig qpidd on


   
2.3 Identity Service(keystone)


keystone作为身份认证服务,其中包括以下的功能:user、token、Tenant、Service、Endpoint、Role、Authentication、Credentials。


2.3.1 安装身份认证服务

# yum install openstack-keystone python-keystoneclient -y

2.3.2 登陆mysql数据库,创建Keystone数据库

# mysql -u root -p
mysql> CREATE DATABASE keystone;
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'keystone';
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'keystone';
mysql> exit

2.3.3 修改keystone配置文件,设置数据库连接,openstack-config 就是之前安装的openstack-utils

# openstack-config --set /etc/keystone/keystone.conf \
   database connection mysql://keystone:keystone@controller/keystone

2.3.4 为keystone数据库创建表

# su -s /bin/sh -c "keystone-manage db_sync" keystone

2.3.5 定义一个授权令牌作为身份服务和其他OpenStack服务之间共享密钥。使用OpenSSL来生成一个随机的令牌并将其存储在配置文件中

# ADMIN_TOKEN=$(openssl rand -hex 10)
# echo $ADMIN_TOKEN
# openstack-config --set /etc/keystone/keystone.conf DEFAULT \
   admin_token $ADMIN_TOKEN

2.3.6 默认情况下,keystone采用PKI令牌。创建签名密钥和证书,并限制访问生成的数据:

# keystone-manage pki_setup --keystone-user keystone --keystone-group keystone
# chown -R keystone:keystone /etc/keystone/ssl
# chmod -R o-rwx /etc/keystone/ssl

2.3.7 启动keystone服务,并加入开机自动启动

# service openstack-keystone start
# chkconfig openstack-keystone on


2.4 Define users, tenants, and roles(定义用户,租户和角色)


安装身份服务后,设置用户、租户和角色,这些都是用来访问服务和端点。

# export OS_SERVICE_TOKEN=ADMIN_TOKEN
# export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0

2.4.1 创建一个admin用户

# keystone user-create --name=admin --pass=admin --email=mikan_zheng@163.com

2.4.2 创建一个admin角色

# keystone role-create --name=admin

2.4.3 创建一个admin租户

# keystone tenant-create --name=admin --description="Admin Tenant"

2.4.5 用user-role-add命令将admin用户、admin角色和admin租户关联在一起

# keystone user-role-add --user=admin --tenant=admin --role=admin

2.4.6 将admin 用户,_member_ role, and admin租户关联起来

# keystone user-role-add --user=admin --role=_member_ --tenant=admin


2.5 Create a normal user(创建一个正常用户)


   

2.5.1 创建一个 demo用户

# keystone user-create --name=demo --pass=demo --email=sd_zhengxin@163.com

2.5.2 创建一个demo 租户:

# keystone tenant-create --name=demo --description="Demo Tenant"

2.5.3 关联 demo用户, _member_ role, and demo 租户

# keystone user-role-add --user=demo --role=_member_ --tenant=demo


2.6 Create a service tenant (创建一个服务租户)



# keystone tenant-create --name=service --description="Service Tenant"


2.7 Define services and API endpoints(定义服务和接口)


2.7.1 定义服务

# keystone service-create --name=keystone --type=identity \
--description="OpenStack Identity"

+-------------+----------------------------------+
|   Property|            Value               |
+-------------+----------------------------------+
| description | OpenStack Identity               |
| id          | 26g17a25681r268r86bc47878b76f4hf |
| name      | keystone                         |
| type      | identity                         |
+-------------+----------------------------------+

2.7.2 定义服务接口(endpoint)

# keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ identity / {print $2}') \
--publicurl=http://controller:5000/v2.0 \
--internalurl=http://controller:5000/v2.0 \
--adminurl=http://controller:35357/v2.0
+-------------+-----------------------------------+
|   Property|             Value               |
+-------------+-----------------------------------+
| adminurl    | http://controller:35357/v2.0      |
| id          | 51f9g735a3b96h8f8e66bf4e5de5634j|
| internalurl | http://controller:5000/v2.0       |
| publicurl   | http://controller:5000/v2.0       |
| region      | regionOne                         |
| service_id| 26g17a25681r268r86bc47878b76f4hf|
+-------------+-----------------------------------+


2.8 Verify the Identity Service installation(安装身份验证服务)


2.8.1 为了正确的安装身份验证服务,首先取消原来设置的环境变量

# unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT

2.8.2 使用admin用户和密码,申请一个身份验证服务

# keystone --os-username=admin --os-password=admin \
--os-auth-url=http://controller:35357/v2.0 token-get

2.8.3 验证授权,为租户请求授权

# keystone --os-username=admin --os-password=admin \
--os-tenant-name=admin --os-auth-url=http://controller:35357/v2.0 \
token-get

2.8.4 将设置的授权编辑到一个文件中admin.sh ,每次使用时source以下这个文件
    export OS_USERNAME=admin
    export OS_PASSWORD=ADMIN_PASS
    export OS_TENANT_NAME=admin
    export OS_AUTH_URL=http://controller:35357/v2.0

2.8.5 source以下admin.sh文件,设置环境变量

# source admin.sh

2.8.6 测试一下是否可以正常获取信息,

例如:

# keystone token-get

# keystone user-role-list --user admin --tenant admin

# keystone user-list

以上命令,如果有返回,说明环境变量已经生效


2.9 Install and configure the OpenStack clients(安装配置openstack客户端)


安装pip

# yum install python-pip

用pip安装opesntack客户端

# pip install python-novaclient



页: [1]
查看完整版本: openstack部署安装(Icehouse版本)-控制节点(Controller)-基本配置