安装计算节点脚本
#!/bin/bash
echo "即将开始时间同步"
/usr/sbin/ntpdate time1.aliyun.com && hwclock -w
echo "时间同步完成"
echo "当前服务器时间-->",`date "+%Y年%m月%d号 %H点%M分%S秒"`
sleep 1
echo "即将开始系统优化,包括内核参数、资源限制以及历史命令格式"
sleep 1
\cp limits.conf /etc/security/limits.conf
\cp sysctl.conf /etc/sysctl.conf
echo "export HISTTIMEFORMAT="%F %T `whoami` "" >> /etc/profile
echo "172.31.7.248 openstack-vip.meng.local" >> /etc/hosts
echo "系统参数优化完成"
sleep 1
yum install centos-release-openstack-train.noarch -y
yum install python-openstackclient openstack-selinux -y
#install nova
echo "即将开始安装nova"
sleep 1
yum install openstack-nova-compute -y
echo "nova 安装完成,即将开始替换配置文件"
sleep 1
tar xvf nova-computer.tar.gz -C /etc/nova
echo "开始替换server_proxyclient_address监听地址"
sleep 1
NODE_IP=`ifconfig eth0 | grep -w inet | awk '{print $2}'`
echo "当前计算节点的管理IP是 ${NODE_IP},即将替换nova.conf文件"
sleep 1
sed -i "s/server_proxyclient_address = 172.31.7.107/server_proxyclient_address = ${NODE_IP}/g" /etc/nova/nova.conf
systemctl start libvirtd.service openstack-nova-compute.service && systemctl enable libvirtd.service openstack-nova-compute.service
#install neutron
echo "即将开始安装neutron"
sleep 1
yum install openstack-neutron-linuxbridge ebtables ipset -y
echo "neutron 安装完成,即将开始替换配置文件"
sleep 1
tar xvf neutron-compute.tar.gz -C /etc/neutron/
\cp linuxbridge_neutron_agent.py /usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py
systemctl start neutron-linuxbridge-agent.service && systemctl enable neutron-linuxbridge-agent.service
echo "当前计算节点nova和neutron服务安装并配置完成,一分钟后即将重启当前服务器,请在服务器重启后查看nova和neutron日志是否有异常日志或到controller节点验证"
sleep 3
shutdown -r +1 "系统将在一分钟后重启,请重启后验证服务是否正常"
compute-install.sh
root soft core unlimited
root hard core unlimited
root soft nproc 1000000
root hard nproc 1000000
root soft nofile 1000000
root hard nofile 1000000
root soft memlock 32000
root hard memlock 32000
root soft msgqueue 8192000
root hard msgqueue 8192000
limits.conf
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.ip_forward = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-arptables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# # Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# # Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
# TCP kernel paramater
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
# socket buffer
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 20480
net.core.optmem_max = 81920
# TCP conn
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 15
# tcp conn reuse
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_max_tw_buckets = 20000
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syncookies = 1
# keepalive conn
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.ip_local_port_range = 10001 65000
# swap
vm.overcommit_memory = 0
vm.swappiness = 10
#net.ipv4.conf.eth1.rp_filter = 0
#net.ipv4.conf.lo.arp_ignore = 1
#net.ipv4.conf.lo.arp_announce = 2
#net.ipv4.conf.all.arp_ignore = 1
#net.ipv4.conf.all.arp_announce = 2
sysctl.conf