Posts

Showing posts from 2018

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 = 5 auto_increment_offset = 2 replicate_wild_ignore_table = %.cache% slave-skip-

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 +------------+--------------+--------------------------------------------------------------------------------+ | Name 

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&q

IBM PowerVC

Regarding of NovaLink: https://www.ibm.com/developerworks/community/blogs/mkmblog/entry/PowerVM_Novalink_Installation?lang=en

Vcenter 6.5 installation/configuration

1> Install: Prepare: DNS/NTP Insert the VCSA ISO into any platform -- Windows/Linux Then click the right platform of installer (Will up to you to use either GUI or CLI) It will build a VCSA application as standalone server on the ESXi host After you done:  Login https://<YOUR_VCSA_IP_OR_FQDN>:5480  < It is the management portal) as root/<YOUR_OWN_PASSWORD> to check everything as well as run the update. To manage the VM, please use https://<YOUR_VCSA_IP_OR_FQDN>

Change the PLEX location on QNAP

If you feel that your video stream is always buffering, You might need to check the network first. If  the network performances OK, then you might think to move the PLEX from STAT drive to SSD drive. Here are steps to move the PLEX application to a different location on QNAP: Step 1> Stop the PLEX service Step 2> Ssh into the QNAP Step 3> Locate the current location. For example: Mine is under /share/CACHEDEV2_DATA/.qpkg/PlexMediaServer Step 4> Copy the entire directory from the current volume to the SSD volume cp -rp /share/CACHEDEV2_DATA/.qpkg/PlexMediaServer  /share/CACHEDEV3_DATA/.qpkg/ Step 5> edit /etc/config/qpkg.conf and search PlexMediaServer and change the volume name from old one to the new one. For example:

Create multiple Linux accounts on Amazon EC2

On LOCAL: [pwang@r710 .ssh]$ ssh-keygen -b 1024 -f <USER_ACCOUNT> -t dsa Generating public/private dsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in <<USER_ACCOUNT>. Your public key has been saved in <USER_ACCOUNT>.pub. The key fingerprint is: ff:85:c1:4f:8c:26:54:2f:62:19:81:b7:9a:71:db:19 pwang@r710 The key's randomart image is: +--[ DSA 1024]----+ |         .o..    | |        . .+ .   | |         .=.. .  | |        .oooE+   | |        S=.o=oo  | |        o..oo=   | |          . . o  | |           . .   | |            .    | +-----------------+ [pwang@r710 .ssh]$ chmod 600 <USER_ACCOUNT>.pub (It is the publick key which will be copied into authorized_file on EC2) [pwang@r710 .ssh]$ chmod 600 <USER_ACCOUNT> (It is the private key) On AMAZON: as root: # useradd <USER_ACCOUNT> # su - <USER_ACCOUNT> # mkdir .ssh &&

Reset MariaDB Root Password

[root@hostname]# systemctl start mariadb [root@hostname]# /etc/init.d/mysql start Starting mysql (via systemctl):                            [  OK  ] [root@hostname]# mysql -u root Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 10.1.30-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> update user set password=PASSWORD("YOUR_PASSWORD") where User='root'; Query OK, 4 rows affected (0.00 sec) Rows matched: 4  Changed: 4  Warnings: 0 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> exit Bye [root@hostnam

xeams http/https stops working after installing the TLS

From xeams.llog: I tried to open a Secure Web Server Port : "Failed to initialize end point associated with ProtocolHandler ["http-bio-443"] java.io.IOException: Keystore was tampered with, or password was incorrect at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:780) at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56) Try the following steps: Stop Xeams Assuming you are on Windows, go to C:\Xeams\config and open AppConfig.xml in any editor such as Notepad. If you are on Linux, this file will be in /opt/Xeams/config folder. Remove the lines containing following parameters: sslCertificateFileName sslCertificatePassword sslCertKeystoreType Save the file Delete/rename C:\Xeams\config\synametrics.cert file so it is not found at runtime Restart Xeams The above steps will make your Xeams download a self-signed certificate again from Synametrics website. For more info, please see -- http://www.xeams.com/a