(+84) 236.3827111 ex. 402

Cài đặt và cấu hình Liberty OpenStack – Phần 2


Cài đặt và cấu hình Liberty OpenStack – Phần 2

Cài đặt NOVA

Cài đặt NOVA trên CONTROLLER

Prerequisites

  • Tạo database cho NOVA

mysql -u root -pOpenstack12345

CREATE DATABASE nova;

GRANT ALL PRIVILEGES ON nova.*TO 'nova'@'localhost'IDENTIFIED BY 'Openstack12345 ';

GRANT ALL PRIVILEGES ON nova.*TO 'nova'@'%'IDENTIFIED BY 'Openstack12345 ';

exit

  • Tạo user, gán role, endpoint cho nova

openstack user create --domain default --password Openstack12345 nova

openstack role add --project service --user nova admin

openstack service create --name nova --description "OpenStack Compute"compute

openstack endpoint create --region RegionOne compute public http://10.10.10.120:8774/v2/%\(tenant_id\)s

openstack endpoint create --region RegionOne compute internal http://10.10.10.120:8774/v2/%\(tenant_id\)s

openstack endpoint create --region RegionOne compute admin http://10.10.10.120:8774/v2/%\(tenant_id\)s

Cài đặt các gói nova trên Controller

apt-get -y install nova-api nova-cert nova-conductor nova-consoleauth nova-novncproxy nova-scheduler python-novaclient

  • Sao lưu file /etc/nova/nova.conf

cp /etc/nova/nova.conf /etc/nova/nova.conf.bak

  • Xóa file gốc

rm /etc/nova/nova.conf

  • Tạo file nova.conf với lệnh vi /etc/nova/nova.conf với nội dung sau:

[DEFAULT]

rpc_backend = rabbit

auth_strategy = keystone

dhcpbridge_flagfile=/etc/nova/nova.conf

dhcpbridge=/usr/bin/nova-dhcpbridge

logdir=/var/log/nova

state_path=/var/lib/nova

lock_path=/var/lock/nova

force_dhcp_release=True

libvirt_use_virtio_for_bridges=True

ec2_private_dns_show_ip=True

api_paste_config=/etc/nova/api-paste.ini

enabled_apis=ec2,osapi_compute,metadata

my_ip = 10.10.10.120

network_api_class = nova.network.neutronv2.api.API

security_group_api = neutron

linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver

firewall_driver = nova.virt.firewall.NoopFirewallDriver

enabled_apis=osapi_compute,metadata

verbose = True

[database]

connection = mysql+pymysql://nova:Openstack12345 @10.10.10.120/nova

[oslo_messaging_rabbit]

rabbit_host = 10.10.10.120

rabbit_userid = openstack

rabbit_password = Openstack12345

[keystone_authtoken]

auth_uri = http://10.10.10.120:5000

auth_url = http://10.10.10.120:35357

auth_plugin = password

project_domain_id = default

user_domain_id = default

project_name = service

username = nova

password = Openstack12345

[vnc]

vncserver_listen = $my_ip

vncserver_proxyclient_address = $my_ip

[glance]

host = 10.10.10.120

[oslo_concurrency]

lock_path = /var/lib/nova/tmp

  • Đồng bộ database cho NOVA

su -s /bin/sh -c "nova-manage db sync"nova

  • Khởi động lại các dịch vụ của NOVA trên Controller Node ``sh service nova-api restart service nova-cert restart service nova-consoleauth restart service nova-scheduler restart service nova-conductor restart service nova-novncproxy restart

- Xóa file SQLite mặc định

```sh

rm -f /var/lib/nova/nova.sqlite

Cài đặt trên NOVA trên COMPUTE NODE

  • Khai báo các gói để cài đặt OpenStack Liberty

apt-get -y install software-properties-common add-apt-repository -y cloud-archive:liberty

  • Thiết lập IP

cat </etc/network/interfaces

# NIC loopback

auto lo

iface lo inet loopback

# NIC MGNG

auto eth0

iface eth0 inet static

address 10.10.10.121

netmask 255.255.255.0

# NIC EXTERNAL

auto eth1

iface eth1 inet static

address 192.168.1.121

netmask 255.255.255.0

gateway 192.168.1.1

dns-nameservers 8.8.8.8

EOF

  • Thiết lập hostname

Cấu hình file /etc/hosts để phân giản IP cho các node

cat </etc/hosts

127.0.0.1 controller localhost

10.10.10.120 controller

10.10.10.121 compute

EOF

Update và khởi động lại node Compute node

apt-get update -y &&apt-get upgrade -y &&apt-get dist-upgrade -y &&init 6

· Đăng nhập lại vào compute node và thực hiện các cài đặt tiếp theo

· Cài đặt gói the OpenStack client

apt-get -y install python-openstackclient

  • Caì đặt gói cho nova-compute

apt-get -y install nova-compute sysfsutils

  • Sao lưu file config cho nova

cp /etc/nova/nova.conf /etc/nova/nova.conf.bak

  • Sửa file vi /etc/nova/nova.conf file với nội dung dưới

[DEFAULT]

dhcpbridge_flagfile=/etc/nova/nova.conf

dhcpbridge=/usr/bin/nova-dhcpbridge

logdir=/var/log/nova

state_path=/var/lib/nova

lock_path=/var/lock/nova

force_dhcp_release=True

libvirt_use_virtio_for_bridges=True

verbose=True

ec2_private_dns_show_ip=True

api_paste_config=/etc/nova/api-paste.ini

enabled_apis=ec2,osapi_compute,metadata

rpc_backend = rabbit

auth_strategy = keystone

my_ip = 10.10.10.121

network_api_class = nova.network.neutronv2.api.API

security_group_api = neutron

linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver

firewall_driver = nova.virt.firewall.NoopFirewallDriver

verbose = True

[oslo_messaging_rabbit]

rabbit_host = 10.10.10.120

rabbit_userid = openstack

rabbit_password = Openstack12345

[keystone_authtoken]

auth_uri = http://10.10.10.120:5000

auth_url = http://10.10.10.120:35357

auth_plugin = password

project_domain_id = default

user_domain_id = default

project_name = service

username = nova

password = Openstack12345

[vnc]

enabled = True

vncserver_listen = 0.0.0.0

vncserver_proxyclient_address = $my_ip

novncproxy_base_url = http://192.168.1.120:6080/vnc_auto.html

[glance]

host = 10.10.10.120

[oslo_concurrency]

lock_path = /var/lib/nova/tmp

  • Khởi động lại nova-compute trên Controller

service nova-compute restart

  • Xóa file SQLite mặc định

rm -f /var/lib/nova/nova.sqlite

  • Kiểm tra lại dịch vụ của NOVA trên Controller

nova service-list

``

- Kết quả sẽ như sau:

```sh

+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+

|Id |Binary |Host |Zone |Status |State |Updated_at |Disabled Reason |

+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+

|1 |nova-cert |controller |internal |enabled |up |2015-11-17T10:00:41.000000 |- |

|2 |nova-consoleauth |controller |internal |enabled |up |2015-11-17T10:00:44.000000 |- |

|3 |nova-scheduler |controller |internal |enabled |up |2015-11-17T10:00:44.000000 |- |

|4 |nova-conductor |controller |internal |enabled |up |2015-11-17T10:00:36.000000 |- |

|6 |nova-compute |compute1 |nova |enabled |up |2015-11-17T10:00:44.000000 |- |

+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+