您好,欢迎来到站长目录(28sn.com)!


Openstack安装与配置

来源:网络整理 浏览:259次 时间:2021-03-01
  • 安装环境

    Memcached编译安装环境
    L:Linux(centos 7.2)

    主机信息:

    CPU >=2C,开启支持虚拟化

    内存 >=3072MB

    HD =100GB

    部署规划:
    172.24.77.221linux1-host.jay.com):运行

    172.24.77.222linux2-host.jay.com):运行

    查看 openstack yum 版本

    yum list centos-release-openstack*

    centos-release-openstack-queens.noarch 1-2.el7.centos extras
    centos-release-openstack-rocky.noarch 1-1.el7.centos extras
    centos-release-openstack-stein.noarch 1-1.el7.centos extras
    centos-release-openstack-train.noarch 1-1.el7.centos extras

    各服务器安装 ocata 的 yum 源

    yum install centos-release-openstack-ocata #旧版本安装,需要yum源支持

    yum install –y centos-release-openstack-queens.noarch

    yum install -y https://rdoproject.org/repos/rdo-release.rpm

    安装文档

    https://docs.openstack.org/ocata/zh_CN/install-guide-rdo/

    各服务器安装 openstack 客户端

    yum install -y python-openstackclient

    各服务器安装 openstack SElinux 管理包

    yum install -y openstack-selinux

    安装数据库服务器:224

    可以单独安装至其他服务器, openstack 的各组件都要使用数据库保存数据, 除了nova 使用
    API 与其他组件进行调用之外

    控制端安 python 连接 SQL 模块:用于控制端连接数据库安装 mariadb

    yum install -y mariadb python2-PyMySQL

    yum install -y mariadb mariadb-server

    配置数据库

    vim /etc/my.cnf.d/openstack.cnf

    [mysqld]
    bind-address = 172.24.77.224
    default-storage-engine = innodb
    innodb_file_per_table = on
    max_connections = 4096
    collation-server = utf8_general_ci
    character-set-server = utf8

    配置 my.cnf

    vim /etc/my.cnf

    datadir=/data/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    symbolic-links=0
    innodb_file_per_table=1
    relay-log=/data/mysql
    server-id=10
    log-error=/data/mysql-log/mysql_error.txt
    log-bin=/data/mysql-bin/master-log
    long_query_time=5
    slow_query_log=1
    slow_query_log_file=/data/mysql-log/slow_mysql.txt
    max_connections=1000
    bind-address=172.24.77.224
    port=3306
    socket=/var/lib/mysql/mysql.sock
    log-error=/data/mysql-log/mysqld-safe.log
    pid-file=/var/lib/mysql/mysql.sock

    创建数据目录并授权

    mkdir -pv /data/{mysql,mysql-log,mysql-binlog}

    chown mysql.mysql /data/*

    启动 Mariadb 并验证

    systemctl start mariadb

    systemctl enable mariadb

    初始化设置

    mysql_secure_installation

    root password:123456

    部署 keepalived:在两台负载服务器同时执行以下操作

    wget http://www.keepalived.org/software/keepalived-1.3.6.tar.gz

    tar xvf keepalived-1.3.6.tar.gz

    cd keepalived-1.3.6

    yum install libnfnetlink-devel libnfnetlink ipvsadm libnl libnl-devel libnl3 libnl3-devel lm_sensors-libs net-snmp-agent-libs net-snmp-libs openssh-server openssh-clients openssl openssl-devel tree sudo psmisc lrzsz gcc gcc-c++ automake pcre pcredevel zlib zlib-devel openssl openssl-devel iproute

    ./configure --prefix=/usr/local/keepalived --disable-fwmark
    make && make install

    准备 keepalived 配置文件 :master 服务器

    mkdir /etc/keepalived

    vim /etc/keepalived/keepalived.conf

    vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 1
    priority 100
    advert_int 1
    unicast_src_ip 172.24.77.224
    unicast_peer {
    172.24.77.225
    }
    authentication {
    auth_type PASS
    auth_pass 123456
    }
    virtual_ipaddress {
    172.24.77.226/25 dev eth0 label eth0:0
    }
    }

    启动keepalive

    systemctl start keepalived

    systemctl enable keepalived

    [root@linux4-host keepalived-1.3.6]# ps -ef |grep keepalive
    root 8478 1 0 01:08 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 8479 8478 0 01:08 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 8480 8478 0 01:08 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 8499 2645 0 01:09 pts/0 00:00:00 grep --color=auto keepalive

    准备 keepalived 配置文件 :backup服务器

    mkdir /etc/keepalived

    vim /etc/keepalived/keepalived.conf

    vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 1
    priority 100
    advert_int 1
    unicast_src_ip 172.24.77.225
    unicast_peer {
    172.24.77.224
    }
    authentication {
    auth_type PASS
    auth_pass 123456
    }
    virtual_ipaddress {
    172.24.77.226/25 dev eth0 label eth0:0
    }
    }

    启动keepalive

    systemctl start keepalived

    systemctl enable keepalived

    [root@localhost keepalived-1.3.6]# ps -ef |grep keepalive
    root 9961 1 0 01:11 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 9962 9961 0 01:11 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 9963 9961 0 01:11 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
    root 9982 3165 0 01:12 pts/0 00:00:00 grep --color=auto keepalive

部署 haproxy

分别在两台负载服务器同时执行以下操作安装 haproxy(版本自定)

wget http://www.haproxy.org/download/1.7/src/haproxy-1.7.9.tar.gz

tar xvf haproxy-1.8.20.tar.gz

cd haproxy-1.8.20

make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 PREFIX=/usr/local/haproxy

make install PREFIX=/usr/local/haproxy

准备 haproxy 启动脚本

vim /usr/lib/systemd/system/haproxy.service

[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/sysconfig/haproxy
ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
$OPTIONS
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target

cp ./haproxy-systemd-wrapper /usr/sbin/haproxy-systemdwrapper#1.8版本无此文件

cp ./haproxy /usr/sbin/haproxy

准备系统配置文件

vim /etc/sysconfig/haproxy

# Add extra options to the haproxy daemon here. This can be useful for
# specifying multiple configuration files with multiple -f options.
# See haproxy(1) for a complete list of options.
OPTIONS=""

配置主配置文件

mkdir /var/lib/haproxy

mkdir /etc/haproxy

vim /etc/haproxy/haproxy.cfg

global
maxconn 100000
uid 99
gid 99
daemon
nbproc 1
log 127.0.0.1 local0 info
chroot /usr/local/haproxy
stats socket /var/lib/haproxy/haproxy.socket mode 600 level admin
defaults
option redispatch
option abortonclose
option http-keep-alive
option forwardfor
maxconn 100000
mode http
timeout connect 10s
timeout client 20s
timeout server 30s
timeout check 5s
listen stats
mode http
bind 0.0.0.0:9999
stats enable
log global
stats uri /haproxy-status
stats auth haadmin:3344521
frontend test
bind 172.24.77.226:80
mode http
default_backend test_http_nodes
backend test_http_nodes
mode http
balance source
server 127.0.0.1 127.0.0.1:80 check inter 2000 fall 3 rise 5

各负载服务器配置内核参数

vim /etc/sysctl.conf

net.ipv4.ip_nonlocal_bind = 1
net.ipv4.ip_forward = 1

sysctl -p

启动 haproxy 并验证

systemctl start haproxy

或者

/usr/local/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg

systemctl enable haproxy

[root@linux4-host ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 172.24.77.224:3306 :
LISTEN 0 128 :9999 :
LISTEN 0 128 172.24.77.226:80
:
LISTEN 0 128
:22 :
LISTEN 0 100 127.0.0.1:25 :
LISTEN 0 128 [::]:22 [::]:
LISTEN 0 100 [::1]:25 [::]:

[root@linux-host5 ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :9999 :
LISTEN 0 128 172.24.77.226:80
:
LISTEN 0 128
:22 :
LISTEN 0 100 127.0.0.1:25 :
LISTEN 0 128 [::]:22 [::]:
LISTEN 0 100 [::1]:25 [::]:

安装 rabbitMQ 服务器225

可以单独安装至其他服务器:各组件通过消息发送与接收是实现组件之间的通信

yum install ncurses ncurses-base ncurses-devel ncurses-libs ncurses-static ncurses-term ocaml-curses ocaml-curses-devel openssl-devel zlib-devel make ncurses-devel gcc gcc-c++ unixODBC unixODBC-devel openssl openssl-devel -y
cd /usr/local/src

安装erlang
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm

安装rpm仓库
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

安装erlang
yum -y install erlang

安装RabbitMQ

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el6.noarch.rpm
yum -y install rabbitmq-server-3.6.6-1.el6.noarch.rpm

启动rabbitmq服务:
service rabbitmq-server start

[root@linux-host5 ~]# service rabbitmq-server start
Starting rabbitmq-server (via systemctl): [ OK ]

安装插件
启动web管理界面
rabbitmq-plugins enable rabbitmq-management

增加访问用户,默认用户guest只能本地访问。
rabbitmqctl add_user admin passwd

设置角色:
rabbitmqctl set_user_tags admin administrator

设置默认vhost("/")访问权限
rabbitmqctl set_permissions -p "/" admin "." "." ".*"

浏览器访问:http://IP:15672

用户名admin,密码passwd进行登录

最好登录console的时候,删除默认账户guest

安装 memcached-225

yum install memcached -y

openstack 安装 python 模块

yum install python-memcached –y

编辑配置文件

vim /etc/sysconfig/memcached
PORT="11212"
USER="memcached"
MAXCONN="1024"
CACHESIZE="512"
OPTIONS="-l 172.24.77.225"

systemctl start memcached

systemctl enable memcached

[root@linux-host5 ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :11212 :*

未完待续。。。

推荐站点

  • 我爱发烧音乐我爱发烧音乐

    我爱发烧音乐囊括了从流行音乐到古典音乐多个类型的音乐作品,专栏推荐最新的音乐,提供音乐排名榜单!可供免费线上收听音乐,歌曲流畅,音效极佳! 网站提供的钢琴以及二胡专栏,可供收听者,陶冶情操,改善心情,是难得的轻音乐典藏!

    www.520fs.com
  • 世纪音乐网世纪音乐网

    世纪音乐网是专业的在线音乐试听MP3下载网站。歌曲总计30余万首,收录了网上最新歌曲和流行音乐,DJ舞曲,非主流音乐,经典老歌,劲舞团歌曲,搞笑歌曲,儿童歌曲,英文歌曲等。是您上网听歌的最佳网站。

    www.ssjj.com
  • 杭州网杭州网

      杭州网是杭州地区唯一的新闻门户网站,由中共杭州市委宣传部、杭州日报报业集团和杭州广播电视集团共同组建的杭州网络传媒有限公司运营。

    www.hangzhou.com.cn
  • 深圳在线深圳在线

      深圳在线 www.szol.net是深圳本地最大、最早的地方生活资讯网站之一,网站名“深圳在线www.szol.net”由南方报业传媒集团编辑委员会总编辑、南方日报社总编辑、南方都市报总编辑、南方书画院名誉院长王春芙亲笔题名,深圳在线www.szol.net团队与深圳热线www.szonline.net、奥一网www.oeeee.com都源于全国最早成立于1996年的知名网络公司——深圳万用网。

    www.szol.net
  • 今题网今题网

     今题网- 中国领先的社区服务网,提供社区服务, 在线交友和商家推广服务,于2004年创建上线,公司现有员工超过百名。今题网自成立以来,凭借其独特的定位和丰富的社区交友功能, 凭借其团队超强的搜索引擎优化技术吸引超过千万的用户成为今题网的注册会员。

    www.jinti.com

鄂公网安备 42062502000001号