美文网首页云计算linuxAlmaLinux
Alma Linux 8 OpenStack入门3--Cinde

Alma Linux 8 OpenStack入门3--Cinde

作者: 負笈在线 | 来源:发表于2022-09-18 21:39 被阅读0次

    1.已部署组件

    主机名 角色 OS installed组件
    controller 控制节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux,mariadb,rabbitmq,memcached,etcd,openstack-keystone,openstack-dashboard,openstack-placement-api,openstack-nova-api,openstack-nova-conductor,openstack-nova-novncproxy,openstack-nova-scheduler
    compute 计算节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux,openstack-nova-compute,openstack-neutron-linuxbridge,ebtables,ipset
    computehci 存储节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux

    2.新部署组件

    主机名 角色 OS install组件
    controller 控制节点 Alma Linux 8.6 openstack-cinder
    compute 计算节点 Alma Linux 8.6
    computehci 存储节点 Alma Linux 8.6 openstack-cinder,targetcli

    3.配置控制节点

    操作对象:控制节点

    3.1.创建cinder数据库及用户

    # mysql -u root -p
    
    > CREATE DATABASE cinder;
    > GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'root';
    > GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'root';
    > flush privileges;
    

    3.2.创建Cinder服务凭证

    #在default域创建用户cinder
    # source admin-openrc
    # openstack user create --domain default --password-prompt cinder
    User Password:
    
    #绑定用户cinder为admin角色
    # openstack role add --project service --user cinder admin
    
    #创建cinderv2和cinderv3服务实体
    # openstack service create --name cinderv2 --description "Openstack Block Storage" volumev2
    # openstack service create --name cinderv3 --description "Openstack Block Storage" volumev3
    

    3.3.创建存储API服务端点

    # openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
    
    # openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
    # openstack endpoint list  --service cinderv2
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    | ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                                      |
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    | 6b11a31d3c9949f49f967262cda7cf3f | RegionOne | cinderv2     | volumev2     | True    | admin     | http://controller:8776/v2/%(project_id)s |
    | cf596194d2b44e55a6599274e1958829 | RegionOne | cinderv2     | volumev2     | True    | internal  | http://controller:8776/v2/%(project_id)s |
    | e187fbcd8aed4815941638479dba9684 | RegionOne | cinderv2     | volumev2     | True    | public    | http://controller:8776/v2/%(project_id)s |
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    # openstack endpoint list  --service cinderv3
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    | ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                                      |
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    | 4709eb4f6c064e90a07791ef288abba3 | RegionOne | cinderv3     | volumev3     | True    | admin     | http://controller:8776/v3/%(project_id)s |
    | b00739ead70245bf83b92bf7ec4a181d | RegionOne | cinderv3     | volumev3     | True    | public    | http://controller:8776/v3/%(project_id)s |
    | d528b8fd3eda4abb8f9c67836d2be6c5 | RegionOne | cinderv3     | volumev3     | True    | internal  | http://controller:8776/v3/%(project_id)s |
    +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
    

    3.4.Cinder组件安装和配置

    #安装cinder组件
    # yum install openstack-cinder
    
    #修改cinder配置文件cinder.conf
    # vi /etc/cinder/cinder.conf
    # grep -Ev "^$|^#" /etc/cinder/cinder.conf
    ...
    [DEFAULT]
    auth_strategy = keystone
    my_ip = 172.26.37.10
    transport_url = rabbit://openstack:awcloud@controller
    [database]
    connection = mysql+pymysql://cinder:root@controller/cinder
    [keystone_authtoken]
    www_authenticate_uri = http://controller:5000
    auth_url = http://controller:5000
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = cinder
    password = 123456
    [nova]
    [oslo_concurrency]
    lock_path = /var/lib/cinder/tmp
    ...
    #填充cinde-api数据库
    # su -s /bin/sh -c "cinder-manage db sync" cinder
    
    #nova配置文件补充cinder相关配置
    # vi /etc/nova/nova.conf
    ...
    [cinder]
    os_region_name = RegionOne
    ...
    
    #启动服务或重启动服务并设置自启动
    # systemctl restart openstack-nova-api.service
    # systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
    # systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
    # systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service
    

    4.配置存储节点

    操作对象:存储节点

    4.1.创建LVM

    #安装LVM组件
    # yum install lvm2 device-mapper-persistent-data
    
    #启动LVM服务
    # systemctl enable lvm2-lvmetad.service
    # systemctl start lvm2-lvmetad.service
    # systemctl status lvm2-lvmetad.service
    
    #添加物理磁盘
    
    #创建 LVM 物理卷/dev/sdb
    # fdisk -l
    # pvcreate /dev/sdb
    # mkfs.ext3 /dev/sdb1
    # 创建LVM卷组cinder-volumes
    # vgcreate cinder-volumes /dev/sdb1
    
    添加过滤
    #vi /etc/lvm/lvm.conf 
    devices {
    ...
    filter = [ "a/sdb/", "r/.*/"]
    

    4.2.cinder-volume服务安装和配置

    #安装cinder-volume组件
    # yum install openstack-cinder targetcli python3-keystone
    
    #修改cinder配置文件cinder.conf
    #vi /etc/cinder/cinder.conf
    # grep -Ev "^$|^#" /etc/cinder/cinder.conf
    ...
    [DEFAULT]
    backup_swift_url = SWIFT_URL
    backup_driver = cinder.backup.drivers.swift.SwiftBackupDriver
    auth_strategy = keystone
    glance_api_servers = http://controller:9292
    my_ip = 172.26.37.30
    enabled_backends = lvm
    target_helper = lioadm
    transport_url = rabbit://openstack:awcloud@controller
    [backend]
    [backend_defaults]
    target_protocol = iscsi
    volume_group = cinder-volumes
    volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
    [database]
    connection = mysql+pymysql://cinder:root@controller/cinder
    [keystone_authtoken]
    www_authenticate_uri = http://controller:5000
    auth_url = http://controller:5000
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = cinder
    password = 123456
    [nova]
    [oslo_concurrency]
    lock_path = /var/lib/cinder/tmp
    ...
    
    #启动cinder-volume服务并设置自启动
    # systemctl enable openstack-cinder-volume.service target.service
    # systemctl start openstack-cinder-volume.service target.service
    # systemctl status openstack-cinder-volume.service target.service
    

    4.3.cinder-backup服务安装和配置

    #安装cinder-backup组件
    # yum install openstack-cinder
    略
    
    #修改cinder配置文件cinder.conf
    #vi /etc/cinder/cinder.conf
    添加如下
    [DEFAULT]
    backup_driver = cinder.backup.drivers.swift.SwiftBackupDriver
    backup_swift_url = SWIFT_URL
    
    #获取SWIFT_URL
    # openstack catalog show object-store
    
    #启动cinder-backup服务并设置自启动
    # systemctl enable openstack-cinder-backup.service
    # systemctl start openstack-cinder-backup.service
    # systemctl status openstack-cinder-backup.service
    

    5.确认Cinder计算服务

    操作对象:控制节点

    操作内容:

    # cinder service-list
    +------------------+----------------+------+---------+-------+----------------------------+---------+-----------------+---------------+
    | Binary           | Host           | Zone | Status  | State | Updated_at                 | Cluster | Disabled Reason | Backend State |
    +------------------+----------------+------+---------+-------+----------------------------+---------+-----------------+---------------+
    | cinder-backup    | computehci     | nova | enabled | up    | 2022-09-17T09:15:44.000000 | -       | -               |               |
    | cinder-scheduler | controller     | nova | enabled | up    | 2022-09-17T09:15:42.000000 | -       | -               |               |
    | cinder-volume    | computehci@lvm | nova | enabled | up    | 2022-09-17T09:15:46.000000 | -       | -               | up            |
    +------------------+----------------+------+---------+-------+----------------------------+---------+-----------------+---------------+
    
    # openstack volume service list
    +------------------+----------------+------+---------+-------+----------------------------+
    | Binary           | Host           | Zone | Status  | State | Updated At                 |
    +------------------+----------------+------+---------+-------+----------------------------+
    | cinder-scheduler | controller     | nova | enabled | up    | 2022-09-17T09:12:52.000000 |
    | cinder-volume    | computehci@lvm | nova | enabled | up    | 2022-09-17T09:12:56.000000 |
    | cinder-backup    | computehci     | nova | enabled | up    | 2022-09-17T09:12:54.000000 |
    +------------------+----------------+------+---------+-------+----------------------------+
    

    如果status不为up,而为down的话,可以检查各个节点的时间同步状态,一般是时间不同步的原因造成。

    相关文章

      网友评论

        本文标题:Alma Linux 8 OpenStack入门3--Cinde

        本文链接:https://www.haomeiwen.com/subject/puruortx.html