• openstack 环境配置及基础组件安装


    配置IP

    [root@template ~]# ifconfig
    ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.182.130  netmask 255.255.255.0  broadcast 192.168.182.255
            inet6 fe80::20c:29ff:fea1:565e  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:a1:56:5e  txqueuelen 1000  (Ethernet)
            RX packets 3588  bytes 1812870 (1.7 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 585  bytes 46575 (45.4 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 1000  (Local Loopback)
            RX packets 8  bytes 712 (712.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 8  bytes 712 (712.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
            ether 52:54:00:9e:2e:40  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    完成 controller、compute01、compute02 上的第 23 块网卡 IP 配置。
    在所有节点上分别执行 dhclient 命令
    # dhclient
    [root@template ~]# dhclient
    [root@template ~]# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:5e brd ff:ff:ff:ff:ff:ff
        inet 192.168.182.130/24 brd 192.168.182.255 scope global ens33
           valid_lft forever preferred_lft forever
        inet 192.168.182.131/24 brd 192.168.182.255 scope global secondary dynamic ens33
           valid_lft 1794sec preferred_lft 1794sec
        inet6 fe80::20c:29ff:fea1:565e/64 scope link 
           valid_lft forever preferred_lft forever
    3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
    5: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:68 brd ff:ff:ff:ff:ff:ff
        inet6 fe80::20c:29ff:fea1:5668/64 scope link 
           valid_lft forever preferred_lft forever
    6: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:72 brd ff:ff:ff:ff:ff:ff
        inet6 fe80::20c:29ff:fea1:5672/64 scope link 
           valid_lft forever preferred_lft forever
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61

    1、在 controller 节点上执行

    [root@template ~]#  cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-ens37
    > TYPE=Ethernet
    > BOOTPROTO=static
    > DEFROUTE=yes
    > IPV6INIT=no
    > NAME=ens37
    > DEVICE=ens37
    > ONBOOT=yes
    > IPADDR=10.168.59.20
    > NETMASK=255.255.255.0
    > EOF
    [root@template ~]# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:5e brd ff:ff:ff:ff:ff:ff
        inet 192.168.182.130/24 brd 192.168.182.255 scope global ens33
           valid_lft forever preferred_lft forever
        inet 192.168.182.131/24 brd 192.168.182.255 scope global secondary dynamic ens33
           valid_lft 1775sec preferred_lft 1775sec
        inet6 fe80::20c:29ff:fea1:565e/64 scope link 
           valid_lft forever preferred_lft forever
    3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
    5: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:68 brd ff:ff:ff:ff:ff:ff
        inet6 fe80::20c:29ff:fea1:5668/64 scope link 
           valid_lft forever preferred_lft forever
    6: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:72 brd ff:ff:ff:ff:ff:ff
        inet6 fe80::20c:29ff:fea1:5672/64 scope link 
           valid_lft forever preferred_lft forever
    [root@template ~]# cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-ens38
    > TYPE=Ethernet
    > BOOTPROTO=static
    > DEFROUTE=yes
    > IPV6INIT=no
    > NAME=ens38
    > DEVICE=ens38
    > ONBOOT=yes
    > IPADDR=20.168.59.20
    > NETMASK=255.255.255.0
    > EOF
    [root@template ~]# systemctl restart network
    [root@template ~]# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:5e brd ff:ff:ff:ff:ff:ff
        inet 192.168.182.130/24 brd 192.168.182.255 scope global ens33
           valid_lft forever preferred_lft forever
        inet6 fe80::20c:29ff:fea1:565e/64 scope link 
           valid_lft forever preferred_lft forever
    3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
        link/ether 52:54:00:9e:2e:40 brd ff:ff:ff:ff:ff:ff
    5: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:68 brd ff:ff:ff:ff:ff:ff
        inet 10.168.59.20/24 brd 10.168.59.255 scope global ens37
           valid_lft forever preferred_lft forever
        inet6 fe80::20c:29ff:fea1:5668/64 scope link 
           valid_lft forever preferred_lft forever
    6: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:a1:56:72 brd ff:ff:ff:ff:ff:ff
        inet 20.168.59.20/24 brd 20.168.59.255 scope global ens38
           valid_lft forever preferred_lft forever
        inet6 fe80::20c:29ff:fea1:5672/64 scope link 
           valid_lft forever preferred_lft forever
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83

    修改hostname

    [root@template ~]#  hostnamectl set-hostname controller
    [root@template ~]# # ping www.baidu.com
    [root@template ~]# 
    [root@template ~]#  ping www.baidu.com 
    PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
    64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=128 time=18.7 ms
    64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=128 time=19.0 ms
    ^C
    --- www.a.shifen.com ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1001ms
    rtt min/avg/max/mdev = 18.709/18.866/19.024/0.208 ms
    [root@template ~]# hostname
    controller
    [root@template ~]# reboot
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    确认网络配置正常

    [root@controller ~]#  ping 20.168.59.32 
    PING 20.168.59.32 (20.168.59.32) 56(84) bytes of data.
    64 bytes from 20.168.59.32: icmp_seq=1 ttl=64 time=0.771 m
    
    [root@controller ~]#  ping 20.168.59.31
    PING 20.168.59.31 (20.168.59.31) 56(84) bytes of data.
    [root@controller ~]#  ping 192.168.182.130
    PING 192.168.182.130 (192.168.182.130) 56(84) bytes of data.
    64 bytes from 192.168.182.130: icmp_seq=1 ttl=64 time=0.018 ms
    [root@controller ~]#  ping 192.168.182.131
    PING 192.168.182.131 (192.168.182.131) 56(84) bytes of data.
    64 bytes from 192.168.182.131: icmp_seq=1 ttl=64 time=0.939 ms
    [root@controller ~]#  ping 192.168.182.132
    PING 192.168.182.132 (192.168.182.132) 56(84) bytes of data.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    NTP 安装及配置

    [root@controller ~]#  ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    [root@controller ~]#  yum -y install chrony
    Loaded plugins: fastestmirror, langpacks
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.ustc.edu.cn
     * extras: mirrors.cqu.edu.cn
     * updates: mirrors.ustc.edu.cn
    Package chrony-3.4-1.el7.x86_64 already installed and latest version
    Nothing to do
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    2、computer配置网络

    [root@template ~]# hostnamectl set-hostname compute01
    [root@template ~]# hostnamectl set-hostname compute01^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^C^C
    [root@template ~]# 
    [root@template ~]# hostname
    compute01
    [root@template ~]# reboot
    Last login: Wed Nov 23 20:17:24 2022 from 192.168.182.1
    [root@compute01 ~]#  cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-ens37
    > TYPE=Ethernet
    > BOOTPROTO=static
    > DEFROUTE=yes
    > IPV6INIT=no
    > NAME=ens37
    > DEVICE=ens37
    > ONBOOT=yes
    > IPADDR=10.168.59.31
    > NETMASK=255.255.255.0
    > EOF
    [root@compute01 ~]# cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-ens38
    > TYPE=Ethernet
    > BOOTPROTO=static
    > DEFROUTE=yes
    > IPV6INIT=no
    > NAME=ens38
    > DEVICE=ens38
    > ONBOOT=yes
    > IPADDR=20.168.59.31
    > NETMASK=255.255.255.0
    > EOF
    [root@compute01 ~]#  systemctl restart network
    [root@compute01 ~]#  ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31

    在控制节点 controller 安装 chrony,将控制节点作为 NTP 服务端,默认已经安装。

    # vi /etc/chrony.conf
    # server ntp.aliyun.com iburst
    # server ntp1.aliyun.com iburst
    server controller iburst
    ...
    ...
    allow 192.168.59.0/24
    allow 10.168.59.0/24
    allow 20.168.59.0/24
    local stratum 10
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    示例

    [root@controller ~]# clear
    # Use public servers from the pool.ntp.org project.
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    server controller iburst
    server controller iburst
    # Record the rate at which the system clock gains/losses time.
    driftfile /var/lib/chrony/drift
    
    # Allow the system clock to be stepped in the first three updates
    server controller iburst
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    
    *server controller iburst*
    
    # Record the rate at which the system clock gains/losses time.
    driftfile /var/lib/chrony/drift
    
    # Allow the system clock to be stepped in the first three updates
    # if its offset is larger than 1 second.
    makestep 1.0 3
    
    # Enable kernel synchronization of the real-time clock (RTC).
    rtcsync
    
    # Enable hardware timestamping on all interfaces that support it.
    #hwtimestamp *
    
    # Increase the minimum number of selectable sources required to adjust
    # the system clock.
    "/etc/chrony.conf" 43L, 1219C written
    [root@controller ~]# vi /etc/chrony.conf 
    [root@controller ~]# systemctl enable chronyd.service 
    Created symlink from /etc/systemd/system/multi-user.target.wants/chronyd.service to /usr/lib/systemd/system/chronyd.service.
    [root@controller ~]#  systemctl start chronyd.service
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43

    在所有计算节点(compute01、compute02)安装 chrony,默认已安装

    # yum -y install chrony
    
    • 1

    然后,修改配置/etc/chrony.conf 中服务器为 controller,即
    计算节点1

    [root@compute01 ~]#  vi /etc/chrony.conf
    [root@compute01 ~]# systemctl enable chronyd
    Created symlink from /etc/systemd/system/multi-user.target.wants/chronyd.service to /usr/lib/systemd/system/chronyd.service.
    [root@compute01 ~]#  systemctl start chronyd
    [root@compute01 ~]#  chronyc sources
    210 Number of sources = 1
    MS Name/IP address         Stratum Poll Reach LastRx Last sample               
    ===============================================================================
    ^* controller                   11   6    17     8  -2023ns[ -519ns] +/-  296ms
    [root@compute01 ~]# cat /etc/chrony.conf 
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    server controller iburst
    # Record the rate at which the system clock gains/losses time.
    driftfile /var/lib/chrony/drift
    
    # Allow the system clock to be stepped in the first three updates
    # if its offset is larger than 1 second.
    makestep 1.0 3
    
    # Enable kernel synchronization of the real-time clock (RTC).
    rtcsync
    
    # Enable hardware timestamping on all interfaces that support it.
    #hwtimestamp *
    
    # Increase the minimum number of selectable sources required to adjust
    # the system clock.
    #minsources 2
    
    # Allow NTP client access from local network.
    #allow 192.168.0.0/16
    
    # Serve time even if not synchronized to a time source.
    #local stratum 10
    
    # Specify file containing keys for NTP authentication.
    #keyfile /etc/chrony.keys
    
    # Specify directory for log files.
    logdir /var/log/chrony
    
    # Select which information is logged.
    #log measurements statistics tracking
    [root@compute01 ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49

    计算节点2

    [root@compute02 ~]#  vi /etc/chrony.conf
    [root@compute02 ~]# systemctl enable chronyd
    Created symlink from /etc/systemd/system/multi-user.target.wants/chronyd.service to /usr/lib/systemd/system/chronyd.service.
    [root@compute02 ~]#  systemctl start chronyd
    [root@compute02 ~]#  chronyc sources
    210 Number of sources = 1
    MS Name/IP address         Stratum Poll Reach LastRx Last sample               
    ===============================================================================
    ^* controller                   11   6    17     2    -48us[  -41us] +/-  298ms
    [root@compute02 ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    MariaDB 安装及配置

    [root@controller ~]# init 0
    Last login: Wed Nov 23 20:10:39 2022 from 192.168.182.1
    [root@controller ~]# cd /etc/yum.repos.d/
    [root@controller yum.repos.d]# ls
    backup                 CentOS-Media.repo
    CentOS-Base.repo       CentOS-Sources.repo
    CentOS-CR.repo         CentOS-Vault.repo
    CentOS-Debuginfo.repo  CentOS-x86_64-kernel.repo
    CentOS-fasttrack.repo  private.repo
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    安装与配置数据库。在控制节点(controller)执行以下操作。

    [root@controller yum.repos.d]#  yum -y install mariadb mariadb-server python2-PyMySQL
    Loaded plugins: fastestmirror, langpacks
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.ustc.edu.cn
     * extras: mirrors.cqu.edu.cn
     * updates: mirrors.ustc.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package mariadb.x86_64 3:10.3.20-3.el7.0.0.rdo1 will be installed
    ---> Package mariadb-server.x86_64 3:10.3.20-3.el7.0.0.rdo1 will be installed
    --> Processing Dependency: mariadb-errmsg(x86-64) = 3:10.3.20-3.el7.0.0.rdo1 for package: 3:mariadb-server-10.3.20-3.el7.0.0.rdo1.x86_64
    ---> Package python2-PyMySQL.noarch 0:0.9.3-1.el7 will be installed
    --> Running transaction check
    ---> Package mariadb-errmsg.x86_64 3:10.3.20-3.el7.0.0.rdo1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ======================================================================
     Package Arch   Version                  Repository              Size
    ======================================================================
    Installing:
     mariadb x86_64 3:10.3.20-3.el7.0.0.rdo1 centos-openstack-train 5.9 M
     mariadb-server
             x86_64 3:10.3.20-3.el7.0.0.rdo1 centos-openstack-train  16 M
     python2-PyMySQL
             noarch 0.9.3-1.el7              epel                    91 k
    Installing for dependencies:
     mariadb-errmsg
             x86_64 3:10.3.20-3.el7.0.0.rdo1 centos-openstack-train 229 k
    
    Transaction Summary
    ======================================================================
    Install  3 Packages (+1 Dependent package)
    
    Total download size: 22 M
    Installed size: 122 M
    Downloading packages:
    (1/4): mariadb-errmsg-10.3.20-3.el7.0.0.rdo1.x86 | 229 kB   00:00     
    (2/4): mariadb-10.3.20-3.el7.0.0.rdo1.x86_64.rpm | 5.9 MB   00:00     
    (3/4): python2-PyMySQL-0.9.3-1.el7.noarch.rpm    |  91 kB   00:00     
    (4/4): mariadb-server-10.3.20-3.el7.0.0.rdo1.x86 |  16 MB   00:00     
    ----------------------------------------------------------------------
    Total                                     68 MB/s |  22 MB  00:00     
    
    
    [mysqld]
    # 此处可只 bind 为内网管理 IP ,限制外部访问
    bind-address = 0.0.0.0
    default-storage-engine = innodb
    innodb_file_per_table = on
    max_connections = 8192
    collation-server = utf8_general_ci
    character-set-server = utf8
    ~                                                                     
    ~                                                  
    ~                                                                     
    <etc/my.cnf.d/openstack.cnf" [New] 8L, 238C written 
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : 3:mariadb-errmsg-10.3.20-3.el7.0.0.rdo1.x86_64     1/4 
      Installing : 3:mariadb-10.3.20-3.el7.0.0.rdo1.x86_64            2/4 
      Installing : 3:mariadb-server-10.3.20-3.el7.0.0.rdo1.x86_64     3/4 
      Installing : python2-PyMySQL-0.9.3-1.el7.noarch                 4/4 
      Verifying  : python2-PyMySQL-0.9.3-1.el7.noarch                 1/4 
      Verifying  : 3:mariadb-10.3.20-3.el7.0.0.rdo1.x86_64            2/4 
      Verifying  : 3:mariadb-server-10.3.20-3.el7.0.0.rdo1.x86_64     3/4 
      Verifying  : 3:mariadb-errmsg-10.3.20-3.el7.0.0.rdo1.x86_64     4/4 
    ;?
    
    [root@controller yum.repos.d]# vim /etc/my.cnf.d/openstack.cnf
    [root@controller yum.repos.d]# vim /etc/my.cnf.d/openstack.cnf
    [root@controller yum.repos.d]# cat /etc/my.cnf.d/openstack.cnf 
    [mysqld]
    # 此处可只 bind 为内网管理 IP ,限制外部访问
    bind-address = 0.0.0.0
    default-storage-engine = innodb
    innodb_file_per_table = on
    max_connections = 8192
    collation-server = utf8_general_ci
    character-set-server = utf8
    [root@controller yum.repos.d]#  vim /usr/lib/systemd/system/mariadb.service
    LimitNOFILE=65535
    LimitNPROC=65535
    注:不修改此配置,max_connections 参数不会生效
    [root@controller yum.repos.d]# systemctl daemon-reload 
    [root@controller yum.repos.d]# systemctl enable mariadb
    Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    [root@controller yum.repos.d]# systemctl start mariadb
    [root@controller yum.repos.d]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96

    数据库初始化设置(可选设置)。

    [root@controller yum.repos.d]# logout
    
    Last login: Wed Nov 23 21:21:47 2022 from 192.168.182.1
    [root@controller ~]#  mysql_secure_installation
    
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MariaDB to secure it, we'll need the current
    password for the root user.  If you've just installed MariaDB, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.
    
    Enter current password for root (enter for none): 
    OK, successfully used password, moving on...
    
    Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation.
    
    Set root password? [Y/n] y
    New password: maste
    Re-enter new password: maste
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    
    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n] y
     ... Success!
    
    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] y
     ... Success!
    
    By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] y
     - Dropping test database...
     ... Success!
     - Removing privileges on test database...
     ... Success!
    
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] y
     ... Success!
    
    Cleaning up...
    
    All done!  If you've completed all of the above steps, your MariaDB
    installation should now be secure.
    
    Thanks for using MariaDB!
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65

    数据库登录验证

    [root@controller ~]#  mysql -uroot -pmysql
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    [root@controller ~]#  mysql -uroot -pmaster
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 17
    Server version: 10.3.20-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> exit
    Bye
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    3 RabbitMQ 安装及配置
    安装与配置 rabbitMQ。在控制节点(controller)执行以下操作

    [root@controller ~]# clear
    [root@controller ~]# yum -y install rabbitmq-server
    Loaded plugins: fastestmirror, langpacks
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.ustc.edu.cn
     * extras: mirrors.cqu.edu.cn
     * updates: mirrors.ustc.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package rabbitmq-server.noarch 0:3.6.16-1.el7 will be installed
    --> Processing Dependency: erlang-xmerl >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-tools >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-stdlib >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-ssl >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-sasl >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-public_key >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-os_mon >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-mnesia >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-kernel >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-erts >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-eldap >= 18 for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Processing Dependency: erlang-sd_notify for package: rabbitmq-server-3.6.16-1.el7.noarch
    --> Running transaction check
    ---> Package erlang-eldap.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-asn1(x86-64) = 19.3.6.4-1.el7 for package: erlang-eldap-19.3.6.4-1.el7.x86_64
    ---> Package erlang-erts.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-kernel.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-mnesia.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-os_mon.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-snmp(x86-64) = 19.3.6.4-1.el7 for package: erlang-os_mon-19.3.6.4-1.el7.x86_64
    --> Processing Dependency: erlang-otp_mibs(x86-64) = 19.3.6.4-1.el7 for package: erlang-os_mon-19.3.6.4-1.el7.x86_64
    ---> Package erlang-public_key.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-crypto(x86-64) = 19.3.6.4-1.el7 for package: erlang-public_key-19.3.6.4-1.el7.x86_64
    ---> Package erlang-sasl.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-sd_notify.x86_64 0:1.0-2.el7 will be installed
    ---> Package erlang-ssl.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-inets(x86-64) = 19.3.6.4-1.el7 for package: erlang-ssl-19.3.6.4-1.el7.x86_64
    ---> Package erlang-stdlib.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-compiler(x86-64) = 19.3.6.4-1.el7 for package: erlang-stdlib-19.3.6.4-1.el7.x86_64
    ---> Package erlang-tools.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-runtime_tools(x86-64) = 19.3.6.4-1.el7 for package: erlang-tools-19.3.6.4-1.el7.x86_64
    ---> Package erlang-xmerl.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Running transaction check
    ---> Package erlang-asn1.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-compiler.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-hipe(x86-64) = 19.3.6.4-1.el7 for package: erlang-compiler-19.3.6.4-1.el7.x86_64
    ---> Package erlang-crypto.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-inets.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-otp_mibs.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-runtime_tools.x86_64 0:19.3.6.4-1.el7 will be installed
    ---> Package erlang-snmp.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Running transaction check
    ---> Package erlang-hipe.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Processing Dependency: erlang-syntax_tools(x86-64) = 19.3.6.4-1.el7 for package: erlang-hipe-19.3.6.4-1.el7.x86_64
    --> Running transaction check
    ---> Package erlang-syntax_tools.x86_64 0:19.3.6.4-1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ======================================================================
     Package           Arch   Version        Repository              Size
    ======================================================================
    Installing:
     rabbitmq-server   noarch 3.6.16-1.el7   centos-openstack-train 4.6 M
    Installing for dependencies:
     erlang-asn1       x86_64 19.3.6.4-1.el7 centos-openstack-train 737 k
     erlang-compiler   x86_64 19.3.6.4-1.el7 centos-openstack-train 1.1 M
     erlang-crypto     x86_64 19.3.6.4-1.el7 centos-openstack-train 122 k
     erlang-eldap      x86_64 19.3.6.4-1.el7 centos-openstack-train 120 k
     erlang-erts       x86_64 19.3.6.4-1.el7 centos-openstack-train 3.0 M
     erlang-hipe       x86_64 19.3.6.4-1.el7 centos-openstack-train 2.6 M
     erlang-inets      x86_64 19.3.6.4-1.el7 centos-openstack-train 766 k
     erlang-kernel     x86_64 19.3.6.4-1.el7 centos-openstack-train 1.1 M
     erlang-mnesia     x86_64 19.3.6.4-1.el7 centos-openstack-train 769 k
     erlang-os_mon     x86_64 19.3.6.4-1.el7 centos-openstack-train 118 k
     erlang-otp_mibs   x86_64 19.3.6.4-1.el7 centos-openstack-train  37 k
     erlang-public_key x86_64 19.3.6.4-1.el7 centos-openstack-train 585 k
     erlang-runtime_tools
                       x86_64 19.3.6.4-1.el7 centos-openstack-train 214 k
     erlang-sasl       x86_64 19.3.6.4-1.el7 centos-openstack-train 293 k
     erlang-sd_notify  x86_64 1.0-2.el7      centos-openstack-train 9.9 k
     erlang-snmp       x86_64 19.3.6.4-1.el7 centos-openstack-train 1.6 M
     erlang-ssl        x86_64 19.3.6.4-1.el7 centos-openstack-train 788 k
     erlang-stdlib     x86_64 19.3.6.4-1.el7 centos-openstack-train 2.4 M
     erlang-syntax_tools
                       x86_64 19.3.6.4-1.el7 centos-openstack-train 408 k
     erlang-tools      x86_64 19.3.6.4-1.el7 centos-openstack-train 567 k
     erlang-xmerl      x86_64 19.3.6.4-1.el7 centos-openstack-train 1.0 M
    
    Transaction Summary
    ======================================================================
    Install  1 Package (+21 Dependent packages)
    
    Total download size: 23 M
    Installed size: 40 M
    Downloading packages:
    (1/22): erlang-compiler-19.3.6.4-1.el7.x86_64.rp | 1.1 MB   00:00     
    (2/22): erlang-asn1-19.3.6.4-1.el7.x86_64.rpm    | 737 kB   00:00     
    (3/22): erlang-crypto-19.3.6.4-1.el7.x86_64.rpm  | 122 kB   00:00     
    (4/22): erlang-eldap-19.3.6.4-1.el7.x86_64.rpm   | 120 kB   00:00     
    (5/22): erlang-erts-19.3.6.4-1.el7.x86_64.rpm    | 3.0 MB   00:00     
    (6/22): erlang-hipe-19.3.6.4-1.el7.x86_64.rpm    | 2.6 MB   00:00     
    (7/22): erlang-inets-19.3.6.4-1.el7.x86_64.rpm   | 766 kB   00:00     
    (8/22): erlang-kernel-19.3.6.4-1.el7.x86_64.rpm  | 1.1 MB   00:00     
    (9/22): erlang-mnesia-19.3.6.4-1.el7.x86_64.rpm  | 769 kB   00:00     
    (10/22): erlang-os_mon-19.3.6.4-1.el7.x86_64.rpm | 118 kB   00:00     
    (11/22): erlang-otp_mibs-19.3.6.4-1.el7.x86_64.r |  37 kB   00:00     
    (12/22): erlang-runtime_tools-19.3.6.4-1.el7.x86 | 214 kB   00:00     
    (13/22): erlang-public_key-19.3.6.4-1.el7.x86_64 | 585 kB   00:00     
    (14/22): erlang-sd_notify-1.0-2.el7.x86_64.rpm   | 9.9 kB   00:00     
    (15/22): erlang-sasl-19.3.6.4-1.el7.x86_64.rpm   | 293 kB   00:00     
    (16/22): erlang-snmp-19.3.6.4-1.el7.x86_64.rpm   | 1.6 MB   00:00     
    (17/22): erlang-ssl-19.3.6.4-1.el7.x86_64.rpm    | 788 kB   00:00     
    (18/22): erlang-syntax_tools-19.3.6.4-1.el7.x86_ | 408 kB   00:00     
    (19/22): erlang-tools-19.3.6.4-1.el7.x86_64.rpm  | 567 kB   00:00     
    (20/22): erlang-stdlib-19.3.6.4-1.el7.x86_64.rpm | 2.4 MB   00:00     
    (21/22): erlang-xmerl-19.3.6.4-1.el7.x86_64.rpm  | 1.0 MB   00:00     
    (22/22): rabbitmq-server-3.6.16-1.el7.noarch.rpm | 4.6 MB   00:00     
    ----------------------------------------------------------------------
    Total                                    9.6 MB/s |  23 MB  00:02     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : erlang-syntax_tools-19.3.6.4-1.el7.x86_64         1/22 
      Installing : erlang-hipe-19.3.6.4-1.el7.x86_64                 2/22 
      Installing : erlang-compiler-19.3.6.4-1.el7.x86_64             3/22 
      Installing : erlang-crypto-19.3.6.4-1.el7.x86_64               4/22 
      Installing : erlang-stdlib-19.3.6.4-1.el7.x86_64               5/22 
      Installing : erlang-erts-19.3.6.4-1.el7.x86_64                 6/22 
      Installing : erlang-kernel-19.3.6.4-1.el7.x86_64               7/22 
      Installing : erlang-mnesia-19.3.6.4-1.el7.x86_64               8/22 
      Installing : erlang-runtime_tools-19.3.6.4-1.el7.x86_64        9/22 
      Installing : erlang-snmp-19.3.6.4-1.el7.x86_64                10/22 
      Installing : erlang-asn1-19.3.6.4-1.el7.x86_64                11/22 
      Installing : erlang-public_key-19.3.6.4-1.el7.x86_64          12/22 
      Installing : erlang-inets-19.3.6.4-1.el7.x86_64               13/22 
      Installing : erlang-ssl-19.3.6.4-1.el7.x86_64                 14/22 
      Installing : erlang-tools-19.3.6.4-1.el7.x86_64               15/22 
      Installing : erlang-sasl-19.3.6.4-1.el7.x86_64                16/22 
      Installing : erlang-eldap-19.3.6.4-1.el7.x86_64               17/22 
      Installing : erlang-otp_mibs-19.3.6.4-1.el7.x86_64            18/22 
      Installing : erlang-os_mon-19.3.6.4-1.el7.x86_64              19/22 
      Installing : erlang-xmerl-19.3.6.4-1.el7.x86_64               20/22 
      Installing : erlang-sd_notify-1.0-2.el7.x86_64                21/22 
      Installing : rabbitmq-server-3.6.16-1.el7.noarch              22/22 
      Verifying  : erlang-snmp-19.3.6.4-1.el7.x86_64                 1/22 
      Verifying  : erlang-kernel-19.3.6.4-1.el7.x86_64               2/22 
      Verifying  : erlang-otp_mibs-19.3.6.4-1.el7.x86_64             3/22 
      Verifying  : erlang-xmerl-19.3.6.4-1.el7.x86_64                4/22 
      Verifying  : erlang-mnesia-19.3.6.4-1.el7.x86_64               5/22 
      Verifying  : erlang-runtime_tools-19.3.6.4-1.el7.x86_64        6/22 
      Verifying  : erlang-syntax_tools-19.3.6.4-1.el7.x86_64         7/22 
      Verifying  : erlang-asn1-19.3.6.4-1.el7.x86_64                 8/22 
      Verifying  : erlang-tools-19.3.6.4-1.el7.x86_64                9/22 
      Verifying  : erlang-eldap-19.3.6.4-1.el7.x86_64               10/22 
      Verifying  : erlang-os_mon-19.3.6.4-1.el7.x86_64              11/22 
      Verifying  : erlang-sd_notify-1.0-2.el7.x86_64                12/22 
      Verifying  : erlang-public_key-19.3.6.4-1.el7.x86_64          13/22 
      Verifying  : erlang-inets-19.3.6.4-1.el7.x86_64               14/22 
      Verifying  : erlang-hipe-19.3.6.4-1.el7.x86_64                15/22 
      Verifying  : erlang-compiler-19.3.6.4-1.el7.x86_64            16/22 
      Verifying  : erlang-crypto-19.3.6.4-1.el7.x86_64              17/22 
      Verifying  : erlang-stdlib-19.3.6.4-1.el7.x86_64              18/22 
      Verifying  : rabbitmq-server-3.6.16-1.el7.noarch              19/22 
      Verifying  : erlang-erts-19.3.6.4-1.el7.x86_64                20/22 
      Verifying  : erlang-sasl-19.3.6.4-1.el7.x86_64                21/22 
      Verifying  : erlang-ssl-19.3.6.4-1.el7.x86_64                 22/22 
    
    Installed:
      rabbitmq-server.noarch 0:3.6.16-1.el7                               
    
    Dependency Installed:
      erlang-asn1.x86_64 0:19.3.6.4-1.el7                                 
      erlang-compiler.x86_64 0:19.3.6.4-1.el7                             
    # systemd unit example
    [Unit]
    Description=RabbitMQ broker
    After=network.target epmd@0.0.0.0.socket
    Wants=network.target epmd@0.0.0.0.socket
    
    [Service]
    Type=notify
    User=rabbitmq
    Group=rabbitmq
    NotifyAccess=all
    TimeoutStartSec=3600
    LimitNOFILE=32768
    
    # Note:
    # You *may* wish to add the following to automatically restart RabbitMQ
    # in the event of a failure. systemd service restarts are not a
    # replacement for service monitoring. Please see
    # http://www.rabbitmq.com/monitoring.html
    #
    # Restart=on-failure
    # RestartSec=10
    "/usr/lib/systemd/system/rabbitmq-server.service" 29L, 769C written
      erlang-crypto.x86_64 0:19.3.6.4-1.el7                               
      erlang-eldap.x86_64 0:19.3.6.4-1.el7                                
      erlang-erts.x86_64 0:19.3.6.4-1.el7                                 
      erlang-hipe.x86_64 0:19.3.6.4-1.el7                                 
      erlang-inets.x86_64 0:19.3.6.4-1.el7                                
      erlang-kernel.x86_64 0:19.3.6.4-1.el7                               
      erlang-mnesia.x86_64 0:19.3.6.4-1.el7                               
      erlang-os_mon.x86_64 0:19.3.6.4-1.el7                               
      erlang-otp_mibs.x86_64 0:19.3.6.4-1.el7                             
      erlang-public_key.x86_64 0:19.3.6.4-1.el7                           
      erlang-runtime_tools.x86_64 0:19.3.6.4-1.el7                        
      erlang-sasl.x86_64 0:19.3.6.4-1.el7                                 
      erlang-sd_notify.x86_64 0:1.0-2.el7                                 
      erlang-snmp.x86_64 0:19.3.6.4-1.el7                                 
      erlang-ssl.x86_64 0:19.3.6.4-1.el7                                  
      erlang-stdlib.x86_64 0:19.3.6.4-1.el7                               
      erlang-syntax_tools.x86_64 0:19.3.6.4-1.el7                         
      erlang-tools.x86_64 0:19.3.6.4-1.el7                                
      erlang-xmerl.x86_64 0:19.3.6.4-1.el7                                
    
    Complete!
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223

    配置 rabbitmq,修改 rabbitmq 默认打开文件句柄数限制

    [root@controller ~]#  vi /usr/lib/systemd/system/rabbitmq-server.service
    在 Service 模块下添加如下参数:
    [Service]
    LimitNOFILE=32768
    
    • 1
    • 2
    • 3
    • 4

    设置开机自启动

    [root@controller ~]# systemctl daemon-reload
    [root@controller ~]#  systemctl enable rabbitmq-server.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
    [root@controller ~]#  systemctl restart rabbitmq-server.service
    
    • 1
    • 2
    • 3
    • 4

    在 rabbitMQ 中添加用于 openstack 的用户并授予管理员权限。

    [root@controller ~]#  rabbitmqctl add_user openstack openstack
    Creating user "openstack"
    [root@controller ~]#  rabbitmqctl set_user_tags openstack administrator
    Setting tags for user "openstack" to [administrator]
    [root@controller ~]#  rabbitmqctl set_permissions openstack ".*" ".*" ".*"
    Setting permissions for user "openstack" in vhost "/"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    启用 rabbitmq-manager 插件,开启 Web 控制

    [root@controller ~]# rabbitmq-plugins enable rabbitmq_management
    The following plugins have been enabled:
      amqp_client
      cowlib
      cowboy
      rabbitmq_web_dispatch
      rabbitmq_management_agent
      rabbitmq_management
    
    Applying plugin configuration to rabbit@controller... started 6 plugins.
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    安装与配置 memcached

    在控制节点(controller)执行以下操作

    [root@controller ~]# clear
    [root@controller ~]#  yum -y install memcached python-memcached
    Loaded plugins: fastestmirror, langpacks
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.ustc.edu.cn
     * extras: mirrors.cqu.edu.cn
     * updates: mirrors.ustc.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package memcached.x86_64 0:1.5.6-1.el7 will be installed
    ---> Package python-memcached.noarch 0:1.58-1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ======================================================================
     Package           Arch    Version      Repository               Size
    ======================================================================
    Installing:
     memcached         x86_64  1.5.6-1.el7  centos-openstack-train  124 k
     python-memcached  noarch  1.58-1.el7   centos-openstack-train   38 k
    
    Transaction Summary
    ======================================================================
    PORT="11211"
    USER="memcached"
    MAXCONN="4096"
    CACHESIZE="256"
    OPTIONS="-l 0.0.0.0,::1"
    ~                                                                
    "/etc/sysconfig/memcached" 5L, 86C written
    Install  2 Packages
    
    Total download size: 162 k
    Installed size: 391 k
    Downloading packages:
    (1/2): memcached-1.5.6-1.el7.x86_64.rpm          | 124 kB   00:00     
    (2/2): python-memcached-1.58-1.el7.noarch.rpm    |  38 kB   00:00     
    ----------------------------------------------------------------------
    Total                                    1.3 MB/s | 162 kB  00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : memcached-1.5.6-1.el7.x86_64                       1/2 
      Installing : python-memcached-1.58-1.el7.noarch                 2/2 
      Verifying  : python-memcached-1.58-1.el7.noarch                 1/2 
      Verifying  : memcached-1.5.6-1.el7.x86_64                       2/2 
    
    Installed:
      memcached.x86_64 0:1.5.6-1.el7 python-memcached.noarch 0:1.58-1.el7
    
    Complete!
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    修改配置

    [root@controller ~]#  vi /etc/sysconfig/memcached
    [root@controller ~]# cat /etc/sysconfig/memcached 
    PORT="11211"
    USER="memcached"
    MAXCONN="4096"
    CACHESIZE="256"
    OPTIONS="-l 0.0.0.0,::1"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    设置服务开机自启

    [root@controller ~]#  systemctl enable memcached.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
    [root@controller ~]#  systemctl restart memcached.service
    
    • 1
    • 2
    • 3

    验证

    [root@controller ~]#  systemctl status memcached
    ● memcached.service - memcached daemon
       Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
       Active: active (running) since Wed 2022-11-23 22:02:49 CST; 12s ago
     Main PID: 4810 (memcached)
        Tasks: 10
       CGroup: /system.slice/memcached.service
               └─4810 /usr/bin/memcached -p 11211 -u memcached -m 256 -...
    
    Nov 23 22:02:49 controller systemd[1]: Started memcached daemon.
    [root@controller ~]# netstat  -atnp |grep 11211
    tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      4810/memcached      
    tcp6       0      0 ::1:11211               :::*                    LISTEN      4810/memcached      
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    etcd 安装及配置(可选安装)在控制节点(controller)执行以下操作

    [root@controller ~]# yum -y install etcd
    Loaded plugins: fastestmirror, langpacks
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.ustc.edu.cn
     * extras: mirrors.cqu.edu.cn
     * updates: mirrors.ustc.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package etcd.x86_64 0:3.3.11-2.el7.centos will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ======================================================================
     Package    Arch         Version                   Repository    Size
    ======================================================================
    Installing:
     etcd       x86_64       3.3.11-2.el7.centos       extras        10 M
    
    Transaction Summary
    ======================================================================
    Install  1 Package
    
    Total download size: 10 M
    Installed size: 45 M
    Downloading packages:
    etcd-3.3.11-2.el7.centos.x86_64.rpm              |  10 MB   00:01     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : etcd-3.3.11-2.el7.centos.x86_64                    1/1 
      Verifying  : etcd-3.3.11-2.el7.centos.x86_64                    1/1 
    
    Installed:
      etcd.x86_64 0:3.3.11-2.el7.centos                                   
    
    Complete!
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42

    2、配置 etcd

    # vi /etc/etcd/etcd.conf
    
    [root@controller ~]# vi /etc/etcd/etcd.conf
    [root@controller ~]# mv /etc/etcd/etcd.conf /etc/etcd/etcd.conf.bak
    [root@controller ~]# vi /etc/etcd/etcd.conf                        
    [root@controller etcd]# cat etcd.conf
    #[Member]
    ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
    ETCD_LISTEN_PEER_URLS="http://192.168.182.130:2380"
    ETCD_LISTEN_CLIENT_URLS="http://192.168.182.130:2379"
    ETCD_NAME="controller"
    #[Clustering]
    ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.182.130:2380"
    ETCD_ADVERTISE_CLIENT_URLS="http://192.168.182.130:2379"
    ETCD_INITIAL_CLUSTER="controller=http://192.168.182.130:2380"
    ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
    ETCD_INITIAL_CLUSTER_STATE="new"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    设置服务开机自启

    [root@controller ~]# systemctl enable etcd
    Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /usr/lib/systemd/system/etcd.service.
    [root@controller ~]# systemctl start etcd
    [root@controller ~]# 
    
    • 1
    • 2
    • 3
    • 4
  • 相关阅读:
    C++多态
    go 设计模式——单例模式
    游戏联运和游戏自主运营有什么区别?哪个更好?
    PCIe Tandem PROM 方法
    PC 的新 AI 操作系统
    【数据结构】单链表实现
    Pytorch之卷积层实战
    GDPU 数据结构 天码行空3
    VR全景技术在教育中的应用:VR教学的“因材施教”
    学node 之前你要知道这些
  • 原文地址:https://blog.csdn.net/weixin_44048054/article/details/128000790