Nova Compute:
nova-compute 一般运行在计算节点上,通过Message Queue接收并管理VM的生命周期。
Nova-compute通过Libvirt管理KVM,通过XenAPI管理Xen等。
node2:
修改主机名:注意:修改主机名,以后不能更改。[[email protected] ~]# hostname linux-node2.smoke.com
[[email protected] ~]# vim /etc/hostname
hostname linux-node2.smoke.com
网卡配置:
[[email protected] ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.56.12 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::9752:504d:ee43:64f5 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:b2:dc:b3 txqueuelen 1000 (Ethernet)
RX packets 23651 bytes 33698486 (32.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6118 bytes 455955 (445.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.47.135 netmask 255.255.255.0 broadcast 192.168.47.255
inet6 fe80::c33f:7c14:d42c:bc06 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:b2:dc:bd txqueuelen 1000 (Ethernet)
RX packets 684 bytes 49408 (48.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 108 bytes 10149 (9.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 20 bytes 1708 (1.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 1708 (1.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
添加hosts文件:
[[email protected] ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.11 linux-node1 linux-node1.smoke.com
192.168.56.12 linux-node2 linux-node2.smoke.com
时间同步:会影响OpenStack正常运行,使用node1作为时间同步服务器;
[[email protected] ~]# yum -y install chrony`
[[email protected] linux-node2 ~]# cat << EOF > /etc/chrony.conf
server 192.168.56.11 iburst
EOF
[[email protected] ~]# systemctl enable chronyd.service
[[email protected] ~]# systemctl start chronyd.service
[[email protected] linux-node2 ~]# chronyc sources
210 Number of sources = 4
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^+ ntp1.flashdance.cx 2 6 313 31 +912us[ +912us] +/- 212ms
^- mirror.muntinternet.net 2 6 17 35 +147ms[ +147ms] +/- 330ms
^- uk.cluster.ntp.faelix.net 2 6 235 34 -5154us[-5154us] +/- 197ms
^* ntp5.flashdance.cx 2 6 335 35 +981us[+6507us] +/- 208ms
设置时区:[[email protected] ~]# timedatectl set-timezone Asia/Shanghai
[[email protected] ~]# date
2018年 09月 30日 星期日 22:33:55 CST
安装nova:
这里还是使用vault.centos的yum源;
[[email protected] ~]# vim /etc/yum.repos.d/openstack_liberty.repo
[openstack-liberty]
name=openstack-liberty
baseurl=http://vault.centos.org/centos/7.3.1611/cloud/x86_64/openstack-liberty/
gpgcheck=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-7
repo_gpgcheck=0
enabled=1
[[email protected] linux-node2 ~]# yum -y install openstack-nova-compute sysfsutils
如果使用vmwave安装需要开启cpu虚拟化支持;
查看是否支持cpu虚拟化,如果没有grep为空白,则表示不支持硬件虚拟化,需要设置服务器使支持,或者使用qemu;
[[email protected] linux-node2 ~]# grep -E ‘vmx|svm‘ /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm arat tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm arat tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm arat tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm arat tpr_shadow vnmi ept vpid fsgsbase tsc_adjust smep
将node1的nova配置文件拷贝到node2;
[[email protected] ~]# scp [email protected]:/etc/nova/nova.conf /etc/nova/
The authenticity of host ‘192.168.56.11 (192.168.56.11)‘ can‘t be established.
ECDSA key fingerprint is f7:b7:90:c0:8e:47:2f:99:d8:37:00:19:4e:28:a0:a4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.56.11‘ (ECDSA) to the list of known hosts.
[email protected]‘s password:
nova.conf 100% 116KB 116.2KB/s 00:00
[[email protected] ~]# vim /etc/nova/nova.conf
[DEFAULT]
my_ip=192.168.56.12
[vnc]
novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html
vncserver_listen=0.0.0.0
vnc_enable=true
vnc_keymap=en-us
[glance]
host=192.168.56.11
[libvirt]
virt_type=kvm
[root[email protected] linux-node2 ~]# grep ‘^[a-z]‘ /etc/nova/nova.conf
my_ip=192.168.56.12
enabled_apis=osapi_compute,metadata
auth_strategy=keystone
network_api_class=nova.network.neutronv2.api.API
linuxnet_interface_driver=nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
security_group_api=neutron
firewall_driver=nova.virt.firewall.NoopFirewallDriver
verbose=true
rpc_backend=rabbit
connection=mysql://nova:[email protected]/nova
host=192.168.56.11
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
virt_type=kvm
lock_path=/var/lib/nova/tmp
rabbit_host=192.168.56.11
rabbit_port=5672
rabbit_userid=openstack
rabbit_password=openstack
novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=$my_ip
vnc_enable=true
nvc_keymap=en-us
启动nova-compute:
[[email protected] linux-node2 ~]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[[email protected] linux-node2 ~]# systemctl start libvirtd.service openstack-nova-compute.service
在node1验证:
[[email protected] ~]# nova service-list
+----+------------------+--------------------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+--------------------------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-scheduler | hostnamelinux-node1.smoke.com | internal | enabled | up | 2018-10-08×××4:27:23.000000 | - |
| 2 | nova-cert | hostnamelinux-node1.smoke.com | internal | enabled | up | 2018-10-08×××4:27:22.000000 | - |
| 3 | nova-consoleauth | hostnamelinux-node1.smoke.com | internal | enabled | up | 2018-10-08×××4:27:25.000000 | - |
| 4 | nova-conductor | hostnamelinux-node1.smoke.com | internal | enabled | up | 2018-10-08×××4:27:25.000000 | - |
| 5 | nova-compute | hostname linux-node2.smoke.com | nova | enabled | up | 2018-10-08×××4:27:16.000000 | - |
+----+------------------+--------------------------------+----------+---------+-------+----------------------------+-----------------+
[[email protected] ~]# openstack host list
+--------------------------------+-------------+----------+
| Host Name | Service | Zone |
+--------------------------------+-------------+----------+
| hostnamelinux-node1.smoke.com | scheduler | internal |
| hostnamelinux-node1.smoke.com | cert | internal |
| hostnamelinux-node1.smoke.com | consoleauth | internal |
| hostnamelinux-node1.smoke.com | conductor | internal |
| hostname linux-node2.smoke.com | compute | nova |
+--------------------------------+-------------+----------+
[[email protected] ~]# nova endpoints
WARNING: keystone has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| keystone | Value |
+-----------+----------------------------------+
| id | 0aa99215a59b4dab9868c9687279f7ca |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:35357/v2.0 |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone | Value |
+-----------+----------------------------------+
| id | 8285e4edfdbb44c1be9137e81a5a383a |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:5000/v2.0 |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone | Value |
+-----------+----------------------------------+
| id | d37c30da6dc74317a1422d2a081eb65d |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:5000/v2.0 |
+-----------+----------------------------------+
WARNING: keystone has no endpoint in ! Available endpoints for this service:
WARNING: keystone has no endpoint in ! Available endpoints for this service:
WARNING: nova has no endpoint in ! Available endpoints for this service:
+-----------+---------------------------------------------------------------+
| nova | Value |
+-----------+---------------------------------------------------------------+
| id | 0c5bb8ed04ff4e30bff474ab693a8e7b |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:8774/v2/d7064a9e91934300b28cccc787161fdb |
+-----------+---------------------------------------------------------------+
+-----------+---------------------------------------------------------------+
| nova | Value |
+-----------+---------------------------------------------------------------+
| id | aacb15c952264c478632facc9953f320 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:8774/v2/d7064a9e91934300b28cccc787161fdb |
+-----------+---------------------------------------------------------------+
+-----------+---------------------------------------------------------------+
| nova | Value |
+-----------+---------------------------------------------------------------+
| id | be2392a0d3a84014b108fda8fe9c08eb |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:8774/v2/d7064a9e91934300b28cccc787161fdb |
+-----------+---------------------------------------------------------------+
WARNING: glance has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| glance | Value |
+-----------+----------------------------------+
| id | 08ee7445c6094fcaa8499f6223cd055f |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:9292 |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance | Value |
+-----------+----------------------------------+
| id | 95134907b0b547f9a1e2c0cbf2a10137 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:9292 |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance | Value |
+-----------+----------------------------------+
| id | b8892b9813bc4f43af23bfeb373534b7 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| url | http://192.168.56.11:9292 |
+-----------+----------------------------------+
[[email protected] ~]# nova image-list
+--------------------------------------+--------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+--------+--------+--------+
| 0297b83c-f9d7-4c19-ab05-762fd4616c49 | cirros | ACTIVE | |
+--------------------------------------+--------+--------+--------+
原文地址:http://blog.51cto.com/smoke520/2296054
时间: 2024-11-10 17:06:20