块存储节点OpenStack基础环境部署
修改网络接口
auto lo
iface lo inet loopback
auto enp6s7
iface enp6s7 inet static
address 10.0.0.41
netmask 255.255.255.0
gateway 10.0.0.1
修改hosts文件
# controller
10.0.0.11 controller
# compute1
10.0.0.31 compute1
#block1
10.0.0.41 block1
修改hostname文件
sudo vim /etc/hostname
将主机名修改为block1,与hosts文件中的值对应
验证连接
ping -c 4 compute1
PING compute1 (10.0.0.31) 56(84) bytes of data.
64 bytes from compute1 (10.0.0.31): icmp_seq=1 ttl=64 time=0.263 ms
64 bytes from compute1 (10.0.0.31): icmp_seq=2 ttl=64 time=0.202 ms
64 bytes from compute1 (10.0.0.31): icmp_seq=3 ttl=64 time=0.203 ms
64 bytes from compute1 (10.0.0.31): icmp_seq=4 ttl=64 time=0.202 ms
--- compute1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.202/0.217/0.263/0.030 ms
安装NTP校时
下载ntp软件包
sudo apt-get install ntp
修改/etc/ntp.conf文件。
sudo vi /etc/ntp.conf
注释或者删除红色框内的内容。
在红框下方添加server controller,表示从controller节点去同步时间。
重启ntp服务
sudo service ntp restart
查看ntp同步状态
ntpq -p
修改时区配置
sudo tzselect
选择区域:Asia(亚洲),输入4
选择国家:china (中国),输入9
选择时区:BeiJing Time (北京时间),输入1
确认验证:yes,输入1
复制配置文件到/etc/localtime,并改名为localtime
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
查看确认
date
下载OpenStack安装包
启用openstack库
sudo apt install software-properties-common
sudo add-apt-repository cloud-archive:pike
更新节点上所有的软件包
sudo apt update && sudo apt dist-upgrade
安装openstack客户端
sudo apt install python-openstackclient
在块存储节点上部署cinder服务
安装lvm逻辑卷管理工具
sudo apt install lvm2
创建物理卷
sudo pvcreate /dev/sdb
sdb为硬盘分区
创建卷组
sudo vgcreate cinder-volumes /dev/sdb
安装cinder-volume
sudo apt install cinder-volume
修改/etc/cinder/cinder.conf文件
设置数据库连接
[database]
# ...
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
设置rabbitmq连接
[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller
将RABBIT_PASS替换为你之前部署rabbitmq时设置的密码
设置keystone访问
[DEFAULT]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
替换CINDER_PASS为你自己的密码
设置ip
[DEFAULT]
# ...
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
替换MANAGEMENT_INTERFACE_IP_ADDRESS为管理网络块存储节点的IP,这里为10.0.0.41
设置lvm参数
[lvm]
# ...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = tgtadm
[DEFAULT]
# ...
enabled_backends = lvm
设置镜像服务调用api
[DEFAULT]
# ...
glance_api_servers = http://controller:9292
设置lock_path
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
完成安装
sudo service tgt restart
sudo service cinder-volume restart