2018年1月31日 星期三

在 CentOS/RHEL 7 上,新增 OpenStack Cinder 儲存節點

學習目標:
  • 在 OpenStack 平台上,增加 Cinder 儲存節點!
  • 本次範例假設 OpenStack 平台上,己經有架設好的 Control 節點!
操作流程:
  1. 在 Cinder 節點主機上,架設好 LVM 儲存空間!
  2. 在 Cinder 節點主機上,安裝必要的套件:
    # yum install openstack-cinder targetcli python-keystone
    
  3. 在 Cinder 節點主機上,修改設定檔內容:
    # cd /etc/cinder
    # vim cinder.conf
    (修改下列設定,其他設定保持不變...)
    [DEFAULT]
    my_ip = 192.168.100.3  (本 Cinder 節點主機想要提供 Cinder 服務的 IP 位置)
    glance_api_servers = http://192.168.100.1:9292 (提供 glance API 連到該 Cinder 的主機清單列表)
    enable_v3_api=True
    storage_availability_zone=nova
    default_availability_zone=nova
    default_volume_type=iscsi
    auth_strategy=keystone
    enabled_backends=lvm-op3 (名稱很重要,請一下需要對應LVM名稱)
    nova_catalog_info=compute:nova:publicURL
    nova_catalog_admin_info=compute:nova:adminURL
    osapi_volume_listen=0.0.0.0
    osapi_volume_workers=32
    iscsi_protocol = iscsi
    debug=False
    log_dir=/var/log/cinder
    transport_url=rabbit://guest:guest@192.168.100.1:5672/
    control_exchange=openstack
    api_paste_config=/etc/cinder/api-paste.ini
    glance_host=192.168.100.1
    [backend]
    [backend_defaults]
    [barbican]
    [brcd_fabric_example]
    [cisco_fabric_example]
    [coordination]
    [cors]
    [database]
    connection=mysql+pymysql://cinder:0d9082d5643849e4@192.168.100.1/cinder
    [fc-zone-manager]
    [healthcheck]
    [key_manager]
    [keystone_authtoken]
    auth_uri=http://192.168.100.1:5000/
    auth_type=password
    auth_url=http://192.168.100.1:35357
    username=cinder
    password=HelloWorld
    project_name=services
    [matchmaker_redis]
    [nova]
    [oslo_concurrency]
    lock_path=/var/lib/cinder/tmp
    [oslo_messaging_amqp]
    [oslo_messaging_kafka]
    [oslo_messaging_notifications]
    driver=messagingv2
    [oslo_messaging_rabbit]
    ssl=False
    [oslo_messaging_zmq]
    [oslo_middleware]
    [oslo_policy]
    policy_file=/etc/cinder/policy.json
    [oslo_reports]
    [oslo_versionedobjects]
    [profiler]
    [ssl]
    [lvm-op3]
    volume_backend_name=lvm
    volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
    iscsi_ip_address=192.168.100.5
    iscsi_helper=lioadm
    volume_group=data
    volumes_dir=/var/lib/cinder/volumes
    
  4. 在 Cinder 節點主機上,新增一下記錄檔:
    # touch /var/log/cinder/volume.log
    # chown root.cinder /var/log/cinder/volume.log
    # chmod g+w /var/log/cinder/volume.log
    # restorecon -R /etc/cinder
    # restorecon -R /var/log/cinder
    
  5. 在 Cinder 節點主機上,啟動 Cinder Volume 服務:
    # systemctl enable openstack-cinder-volume.service target.service
    # systemctl start openstack-cinder-volume.service target.service
    
  6. 在 Control 節點主機上,查詢 Cinder 服務:
    (keystone_admin)]# cinder service-list
    

參考範例:
  • https://docs.openstack.org/mitaka/install-guide-rdo/cinder-storage-install.html

2018年1月14日 星期日

在 CentOS/RHEL 7 上安裝 OpenStack 套件

學習目標:
  • 在多節點的硬體平台基礎上,安裝 OpenStack 套件!
  • 本次範例以三個節點為示範!
操作流程:
  1. 三部主機同時安裝相關的套件:
    # yum update
    # reboot
    
  2. 三部主機可暫時停用防火牆:
    # systemctl disable firewalld 
    # systemctl stop firewalld (重開機後,會自動啟動!需要時,仍需要關上!)
    
  3. 三部主機同時設定 chronyd:
    # yum install chrony
    # vim /etc/chrony.conf
    server time.stdtime.gov.tw iburst
    
    # systemctl enable chronyd.service
    # systemctl restart chronyd.service
    
  4. 三部主機上,停用 NetworkManger 套件,並同時啟用 network 套件:
    # systemctl stop NetworkManager
    # systemctl disable NetworkManager
    # systemctl enable network
    # hostnamectl set-hostname control.example.com (每部均不相同!)
    # reboot
    
  5. 在 Control Node 上,設定連線用的 ssh key:
    # ssh-keygen
    # ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.2
    # ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.3
    # ssh network
    
  6. 在 Control Node 上,修改 /etc/hosts 檔案:
    # vim /etc/hosts
    (其他省略...)
    192.168.1.1 control control.example.com
    192.168.1.2 network network.example.com
    192.168.1.3 compute1 compute1.example.com
    
  7. 在 Control Node 上,將 /etc/hosts 檔案送至另兩部主機上:
    # scp /etc/hosts root@192.168.1.2:/etc/
    # scp /etc/hosts root@192.168.1.3:/etc/
    
  8. 在三部主機上,安裝 OpenStack Pike 倉儲套件:
    # yum install centos-release-openstack-pike
    # yum upgrade
    # reboot
    # yum install python-openstackclient
    # yum install openstack-selinux
    
  9. 在 Control Node 上,安裝 PackStack 套件,用來協助安裝、設定 OpenStack:
    # yum install openstack-packstack
    
  10. 在 Control Node 上,產生 answer.txt 檔案,並且編修內容:
    # packstack --gen-answer-file=/root/answer.txt
    # vim /root/answer.txt
    (部份省略,只顯示必須修改的要項...)
    CONFIG_DEFAULT_PASSWORD=a123456
    CONFIG_CEILOMETER_INSTALL=y
    CONFIG_NTP_SERVERS=tick.stdtime.gov.tw
    CONFIG_CONTROLLER_HOST=192.168.1.1
    CONFIG_COMPUTE_HOSTS=192.168.1.3
    CONFIG_NETWORK_HOSTS=192.168.1.2
    CONFIG_PROVISION_DEMO=n
    CONFIG_KEYSTONE_ADMIN_PW=a123456
    CONFIG_HEAT_INSTALL=y
    CONFIG_CINDER_VOLUMES_CREATE=y
    CONFIG_LBAAS_INSTALL=y
    CONFIG_CINDER_VOLUME_NAME=data
    CONFIG_NEUTRON_METERING_AGENT_INSTALL=y
    CONFIG_NEUTRON_FWAAS=y
    CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vlan
    CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vlan
    CONFIG_NEUTRON_ML2_VLAN_RANGES=physnet1:1:1000
    CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-eth1
    CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-eth1:eth1
    CONFIG_HEAT_CFN_INSTALL=y
    CONFIG_HORIZON_SSL=y
    CONFIG_SWIFT_INSTALL=n
    
  11. 在 Control Node 上,執行安裝 OpenStack 套件:
    # packstack --answer-file=/root/answer.txt
    

參考文獻:
  • http://www.techsupportpk.com/2016/12/installing-openstack-on-multi-node-in-linux.html
  • https://www.linuxtechi.com/multiple-node-openstack-liberty-installation-on-centos-7-x/
  • https://www.linuxtechi.com/multinode-openstack-newton-installation-centos7/