I use this script to update Racktables databases value

import MySQLdb
import xlrd
import time
import sys
reload(sys)
sys.setdefaultencoding("utf-8")

def get_table():
    FILE_NAME = 'owner.xls'
    data = xlrd.open_workbook(FILE_NAME)
    table = data.sheets()[0]
    return table

def insert_by_many(table):
    nrows = table.nrows
    param=[]
    for i in xrange(1,nrows):
        #param.append([table.cell(i, 0).value, table.cell(i, 1).value])
        #change to 3 values for the new sql script
        param.append([table.cell(i, 0).value, table.cell(i, 1).value])
        print param
    try:
        #sql = 'UPDATE AttributeValue JOIN Object ON AttributeValue.object_id = Object.id SET AttributeValue.string_value = %s WHERE AttributeValue.attr_id=14 and Object.name = %s'
        #update sql script, if not exist insert , if exist update, like "UPSERT", so param list should have three value
        sql = "insert into AttributeValue (object_id, object_tid, attr_id, string_value) select id, objtype_id, '14', %s from Object where name=%s on duplicate key update AttributeValue.string_value=%s"
        cur.executemany(sql, param)
        conn.commit()
    except Exception as e:
        print e
        conn.rollback()
    print '[insert_by_many executemany] total:',nrows-1


conn = MySQLdb.connect(host="127.0.0.1", port=3306, user="root", passwd="password", db="racktables")
cur = conn.cursor()

table = get_table()


start = time.clock()
insert_by_many(table)
end = time.clock()
print '[insert_by_many executemany] Time Usage:',end-start

if cur:
    cur.close()
if conn:
    conn.close()

sometimes you install a linux server and have a driver bigger than 2T, so you make two virtual disks and dont want to mount the /dev/sdb to a folder

parted --script /dev/sdb mklabel gpt
parted --script /dev/sdb mkpart primary 512 100%
pvcreate -f /dev/sdb1
vgextend vg_centos /dev/sdb1
lvresize -l 100%VG /dev/vg_centos/lv_root
xfs_growfs /dev/mapper/vg_centos-lv_root
df -h

Check Docker Info

Check Docker Version

docker version

check docker system info

docker info

Image

search images

docker search image_name

download images

docker puch image_name

list images

docker images

delete one or more images

docker rmi image_name

show docker image history

docker history image_name

start container

run cmd “echo” in container and output “hello world”

docker run image_name echo "hello world"

login container tty

docker run -i -t image_name /bin/bash

install package in the container

docker run image_name apt-get install -y package-name

Check container

list all the running containers

docker ps

list all the containers include offline

docker ps -a 

list last time running container

docker ps -l

save modified container to a new image

docker commit ID new_image_name

container operations

delete all the containers

docker rm 'docker ps -a -q'

delete specific container

docker rm NAME/ID

start, stop, kill specific container

docker start NAME/ID
docker stop NAME/ID
docker kill NAME/ID

list the modified file or folder in the container

docker diff NAME/ID

check log of container

docker log NAME/ID

check process of the container

docker top NAME/ID

copy file from container to local path

docker cp NAME:/container_path local_path
docker cp ID:/container_path local_path

restar a running container

docker restart NAME/ID

attach container

docker attach ID

Save and load images

save image to a tar

docker save image_name -o file_path

load tar format image

docker load -i file_path

login registry server

docker login

publish an image

docker push new_image_name

10 commands

  • uptime
  • dmesg | tail
  • mpstat -P ALL 1
  • pidstat 1
  • iostat -xz 1
  • free -m
  • sar -n DEV 1
  • sar -n TCP,ETCP 1
  • top

maybe you need

 yum -y install procps sysstat

Fuel is an open-source software application that simplifies the deployment of highly available OpenStack environments, as well as enables you to manage your OpenStack environments after deployment.

Download Fuel ISO

Download Fuel community version from www.fuel-infra.org/

Last Stable Release is fuel-community-9.0 here is the ISO.TORRENT

Create a VM for Fuel

Hardware requirement

For a production: Quad-core CPU 4 GB RAM 10 Gigabit network port Disk size depends on the number of deployed nodes. All nodes send logs to the Fuel Master node using rsyslog. During installation, Fuel creates a separate partition for /var to store the remote logs and allocates 40% of the disk size to it. Our recommendation for the remote logs partition is 20 GB per node. If you deploy 10 nodes with Fuel, you need to have a (20 x 10) x 2.5 = 500 GB disk for the Fuel Master node. IPMI access through an independent management network

For a testing environment: Dual-core CPU 2 GB RAM 1 Gigabit network port 50 GB disk Physical console access

Here is my VM spec: