[root@controller ~]# cat /etc/chrony.conf # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst server ntp.aliyun.com iburst
# Record the rate at which the system clock gains/losses time. driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC). rtcsync
# Enable hardware timestamping on all interfaces that support it. #hwtimestamp *
# Increase the minimum number of selectable sources required to adjust # the system clock. #minsources 2
# Allow NTP client access from local network. #allow 192.168.0.0/16 allow 0.0.0.0/0
# Serve time even if not synchronized to a time source. #local stratum 10
# Specify file containing keys for NTP authentication. #keyfile /etc/chrony.keys
# Specify directory for log files. logdir /var/log/chrony
# Select which information is logged. #log measurements statistics tracking
#授予权限 MariaDB [(none)]>GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'controller' IDENTIFIED BY 'KEYSTONE_DBPASS'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \ IDENTIFIED BY 'KEYSTONE_DBPASS'; Query OK, 0 rows affected (0.00 sec)
#在数据库里赋予权限 MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'controller' IDENTIFIED BY 'GLANCE_DBPASS'; Query OK, 0 rows affected (0.00 sec)
#加载凭据 [root@controller ~]# source openrc
#创建openstack用户glance [root@controller ~]# openstack user create --domain default --password-prompt glance User Password:glance Repeat User Password:glance +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | ee04eaf7ed1a47bd82a9fb8c9b2e4821 | | name | glance | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
#创建service project [root@controller ~]# openstack project create --domain default --description "Service Project" service +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Service Project | | domain_id | default | | enabled | True | | id | d6b1c07a6f3e4dd89b2b9dcfc83962f9 | | is_domain | False | | name | service | | parent_id | default | | tags | [] | +-------------+----------------------------------+
#赋予glance用户管理员权限 [root@controller ~]# openstack role add --project service --user glance admin
#创建一个glance的service,也可以理解成没有endpoint的catalog文件 [root@controller ~]# openstack service create --name glance --description "OpenStack Image" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image | | enabled | True | | id | efe5335aa41a41dd9de475d52cb87487 | | name | glance | | type | image | +-------------+----------------------------------+
#对数据库进行授权 GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'controller' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'controller' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'controller' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_DBPASS'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'controller' IDENTIFIED BY 'PLACEMENT_DBPASS'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_DBPASS';
#创建nova用户 [root@controller ~]# openstack user create --domain default --password-prompt nova User Password: nova Repeat User Password: nova +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 7d2b31aa06d7457598661834b7f07951 | | name | nova | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user nova admin
[root@controller ~]# openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 4accdf48ffd54f49afed14fefdc12b52 | | name | nova | | type | compute | +-------------+----------------------------------+
#创建placement用户 [root@controller ~]# openstack user create --domain default --password-prompt placement User Password: placement Repeat User Password: placement +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | d3c8ccc354754629a5f2eec812c3aef5 | | name | placement | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user placement admin
[root@controller ~]# openstack service create --name placement --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Placement API | | enabled | True | | id | 850d593b366249af8b963e2790906b58 | | name | placement | | type | placement | +-------------+----------------------------------+
#创建endpoint [root@controller ~]# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 03347612807f4fe2a4101c8794729985 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 4accdf48ffd54f49afed14fefdc12b52 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+
#测试 [root@compute1 ~]# source openrc [root@compute1 ~]# openstack compute service list --service nova-compute +----+--------------+----------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+----------+------+---------+-------+----------------------------+ | 9 | nova-compute | compute1 | nova | enabled | up | 2021-07-08T13:24:10.000000 | +----+--------------+----------+------+---------+-------+----------------------------+ [root@compute1 ~]# openstack compute service list --service nova-compute +----+--------------+----------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+----------+------+---------+-------+----------------------------+ | 9 | nova-compute | compute1 | nova | enabled | up | 2021-07-08T13:25:30.000000 | | 10 | nova-compute | compute2 | nova | enabled | up | 2021-07-08T13:25:30.000000 | +----+--------------+----------+------+---------+-------+----------------------------+
#在控制节点上识别到控制节点 [root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova Found 2 cell mappings. Skipping cell0 since it does not contain hosts. Getting computes from cell 'cell1': 6a7e75b3-a752-4076-9785-f1e54d64cbe1 Checking host mapping for compute host 'compute1': f6c4f92c-2ccc-494b-afc3-a25e5eee12d4 Creating host mapping for compute host 'compute1': f6c4f92c-2ccc-494b-afc3-a25e5eee12d4 Checking host mapping for compute host 'compute2': 98bff046-551f-4d62-8f72-7ddc3ce45f69 Creating host mapping for compute host 'compute2': 98bff046-551f-4d62-8f72-7ddc3ce45f69 Found 2 unmapped computes in cell: 6a7e75b3-a752-4076-9785-f1e54d64cbe1
#在控制节点上安装neutron(实际上neutron是要安装在网络节点上的,这里是将控制节点也当成网络节点) 1、创建数据库并授权 MariaDB [(none)]> CREATE DATABASE neutron; 2、创建用户并分配相应的role GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_DBPASS'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'controller' IDENTIFIED BY 'NEUTRON_DBPASS'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_DBPASS'; 3、创建空的catalog [root@controller ~]# openstack user create --domain default --password-prompt neutron User Password: neutron Repeat User Password: neutron +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 3dac15bb7ace4f8584030d210721d847 | | name | neutron | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user neutron admin
[root@controller ~]# openstack service create --name neutron --description "OpenStack Networking" network +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Networking | | enabled | True | | id | 1fb5f34378df4aafa413d2898c5b6912 | | name | neutron | | type | network | +-------------+----------------------------------+ 4、创建endpoint [root@controller ~]# openstack endpoint create --region RegionOne network public http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | d75fa491f5894d769a4d120f62f07722 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 1fb5f34378df4aafa413d2898c5b6912 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+
[root@control ~]# openstack server list +--------------------------------------+-----------+--------+-----------------+--------+--------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+-----------------+--------+--------+ | d822e18a-9049-4827-8b46-ae47fc475227 | zy-server | ACTIVE | zy-test=1.1.1.3 | cirros | small | +--------------------------------------+-----------+--------+-----------------+--------+--------+