Posts

Cleanup Openstack Script

When I am working on the openstack, I found that my design is not a right design. So I have to restart it from a scratch. I wrote a script to clean up the openstack. Any comments are welcome! Another best way to do that is to take a snapshot before implementing the openstack if snapshot is an option. rebuild openstack: for i in `systemctl list-unit-files |grep openstack |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done for i in `systemctl list-unit-files |grep neutron |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done for i in `systemctl list-unit-files |grep rabbitmq |grep enabled |awk '{print $1}'`; do systemctl stop $i; systemctl disable $i; done for i in "openvswitch ip6tables ovsdb-server ovs-vswitchd neutron-server httpd libvirtd virtlockd iscsi redis memcached gssproxy ksmtuned tuned" do   systemctl stop $i   systemctl disable $i done cd /etc/openvswitch mv con...

HA in Linux is pretty easy

NOTICE: -- Very important: Please do NOT FAT FINGER. Check your IP address/hostname correct first before configuring PCS. If any service(s) do(es) not startup correctly, please check the service log under /var/log/cluster or /var/log/pcsd. systemctl -xe does not help at all 1> Install PCS  yum isntall pcs -y 2>  Configure PCS. Please run the following commands on ALL nodes: systemctl start pcsd systemctl enable pcsd passwd hacluster 3> Configure PCS, Run he following commands on ONE node: pcs cluster auth <NODE-1> <NODE-2> <...> pcs cluster setup --name <CLUSTER_NAME> <NODE-1> <NODE-2> <...> pcs cluster start --all pcs cluster enable --all pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=<IP_ADDR> cidr_netmask=32 op monitor interval=30s pcs resource create <APPLICATION_MON> ocf:heartbeat:nginx configfile=/etc/nginx/nginx.conf op monitor timeout="5s" interval="5s"  ...

MariaDB replicate

/etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd max_allowed_packet=32M max_connections=500 #innodb_log_buffer_size = 32M innodb_buffer_pool_size=6G key_buffer_size = 10M #innodb_log_file_size = 768M #Replication server_id       = 67 log-bin         = /var/lib/mysql/mysql-bin log-bin-index   = /var/lib/mysql/mysql-bin.index relay-log       = /var/lib/mysql/mysql-relay-bin relay-log-index = /var/lib/mysql/mysql-relay-bin.index binlog-format   = mixed expire_logs_days= 5 max_binlog_size = 100M auto_increment_increment ...

Install openstack is EASY!

1> Install CentOS mini OS 2> Disable the firewalld/NetworkManager & enable network systemctl stop firewalld systemctl disable firewalld systemctl stop NetworkManage systemctl disable NetworkManage systemctl enable network systemctl start network 2>  yum -y update 3>  yum -y install centos-release-openstack-queens epel-release 4>  yum -y install openstack-packstack python-pip 5>  packstack --allinone took about 20 mins, you will see this message: OPTION: if you want to edit the configuration before building: packstack --gen-answer-file=openstack.conf then you can edit the configuration; then type: packstack --answer-file=openstack.conf yum -y install openstack-neutron-lbaas haproxy openstack-utils  **** Installation completed successfully ****** [root@vm01 ~(keystone_admin)]# openstack catalog list +------------+--------------+-------------------------------------------------------------------...

Generate OVA/OVF

Since Vsphere 6.5, it recommends to use ovftool to convert the OVF/OVA. Before doing it, please remember disconnect your CDROM/DVDROM. Otherwise, the data on CD/DVD will be included in the OVF/OVA OVF --> WAX --> OVA C:\Program Files\VMware\VMware OVF Tool>ovftool.exe vi://192.168.1.99/Boxborough /vm/win7 C:\Users\pwang\Desktop\ovfs Enter login information for source vi://192.168.1.99/ Username: administrator@vsphere.local Password: ************ Opening VI source: vi://administrator%40vsphere.local@192.168.1.99:443/Boxboroug h/vm/win7 Opening VI source: vi://administrator%40vsphere.local@192.168.1.99:443/Boxboroug h/vm/win7 Opening OVF target: C:\Users\pwang\Desktop\ovfs Writing OVF package: C:\Users\pwang\Desktop\ovfs\win7\win7.ovf Transfer Completed Completed successfully C:\Users\pwang\Desktop\ovfs\vm02>"C:\Program Files\VMware\VMware OVF Tool\ovftoo l.exe" vm02.ovf C:\Users\pwang\Desktop\vmx\vm02.vmx Opening OVF source: vm02.ovf The manife...

PowerVC

1> Reference: http://chmod666.org/index.php/tag/powervc/

CentOS repo

It is my script to sync my internal CentOS with mirrors. Please change it based on your environment such as TARGET #!/bin/bash # This script rsyncs rpms down to the local Yumrepo server. # It then creates a separate shell script (yum-createrepo-post-rsync-$Version2.sh) # which runs createrepo in necessary folders. ##### # variables that should be updated ##### Version1="7.4.1708"  #Actual version of CentOS: 7.4. Version2="${Version1}"  #Version of CentOS plus type. ex 6.6 basic. RsyncSource="rsync://mirror.rackspace.com/centos" ##### # variables ##### YearMonth=`date "+%Y%m"` Source1="$RsyncSource/$Version1" Target1="/data/www" Target2="yum-rpms/centos$Version2" Target3="$Version1/os/x86_64" Target="$Target1/$Target2/$Target3" Target="/data/www/yum-rpms/centos$Version2" # where rpms are kept on local server Create="yum-createrepo-post-rsync-$Version2.sh...