Skip to content

Instantly share code, notes, and snippets.

@rayhassan
Created May 11, 2017 13:32
Show Gist options
  • Save rayhassan/e11b5325b4b9cd9d3e84fa40147def57 to your computer and use it in GitHub Desktop.
Save rayhassan/e11b5325b4b9cd9d3e84fa40147def57 to your computer and use it in GitHub Desktop.
Nutanix Docker Volume plugin notes - v2 API
o install Docker
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum install docker-ce
sudo systemctl enable docker
sudo systemctl start docker
o install ISCSI pkgs
yum install iscsi-initiator-utils
systemd-tmpfiles --create
systemctl start iscsid
systemctl enable iscsid
Ensure iscsid is running using: systemctl status iscsid
o Install Nutanix Docker Volume driver
docker plugin install ntnx/nutanix_volume_plugin PRISM_IP="10.68.64.55" DATASERVICES_IP="10.68.64.254" PRISM_PASSWORD="nutanix/4u" PRISM_USERNAME="admin" DEFAULT_CONTAINER="DEFAULT-CTR" --alias nutanix
check plugin is installed and enabled
docker plugin ls
ID NAME DESCRIPTION ENABLED
61628d009788 nutanix:latest Nutanix volume plugin for docker true
o Install docker-machine
curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
o Install Nutanix docker-machine driver
wget http://download.nutanix.com/utils/docker-machine-driver-nutanix.linux
cp docker-machine-driver-nutanix.linux /usr/local/bin/docker-machine-driver-nutanix
chmod +x /usr/local/bin/docker-machine-driver-nutanix
ls -l /usr/local/bin/docker-machine*
-rwxr-xr-x. 1 root root 25291488 Apr 5 14:40 /usr/local/bin/docker-machine
-rwxr-xr-x. 1 root root 11126592 Apr 5 15:06 /usr/local/bin/docker-machine-driver-nutanix
docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Container-Host-Image --nutanix-vm-network vlan.68 dvm01
docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dvm01 - nutanix Running tcp://10.68.68.103:2376 v1.12.1
./start-volume-plugin.sh
Starting Nutanix volume plugin container...
Updating volume plugin...
Using default tag: latest
latest: Pulling from orionapps/vol-plugin
a3ed95caeb02: Already exists
30826c675999: Already exists
7bc582c5c440: Already exists
Digest: sha256:2e355025686ee37e0f8d66e1e5674bae175777bcb2b079b5b65fdfe12aeccfd0
Status: Image is up to date for orionapps/vol-plugin:latest
sed: can't read /etc/systemd/system/docker.service: No such file or directory
Redirecting to /bin/systemctl restart docker.service
Enter prism ip address: 10.68.64.55
Enter Dataservices ip address: 10.68.64.254
Enter prism username: admin
Enter prism password:
Enter nutanix container where you want persistent volumes: DEFAULT-CTR
prism ip address : 10.68.64.55
dataservice ip address: 10.68.64.254
prism username : admin
default container : DEFAULT-CTR
a3ddf1b50cc76558a090986a4a10c8261e75a2c22529762167222f22e4315833
docker run -d --name pg01 -p5432:5432 --volume-driver nutanix -v pgdata01:/var/lib/postgresql/data postgres:latest
]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a315748f8f1d postgres:latest "docker-entrypoint.sh" 27 seconds ago Up 12 seconds 0.0.0.0:5432->5432/tcp pg01
a3ddf1b50cc7 orionapps/vol-plugin "/code/scripts/docker" About an hour ago Up About an hour NutanixVolumePlugin
[root@dvm02 ~]# docker exec -it a315748f8f1d /bin/bash
root@a315748f8f1d:/# psql -U postgres
psql (9.6.2)
Type "help" for help.
postgres=# CREATE DATABASE nutanix with owner postgres ; CREATE DATABASE nutanix with owner postgres ;
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
nutanix | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# \q
# docker volume ls
DRIVER VOLUME NAME
nutanix pgdata01
[root@dvm02 ~]# docker volume inspect pgdata01
[
{
"Name": "pgdata01",
"Driver": "nutanix",
"Mountpoint": "/var/lib/nutanix/pgdata01/pgdata01",
"Labels": null,
"Scope": "local"
}
]
docker run -e MYSQL_ALLOW_EMPTY_PASSWORD=1 --name msql01 -p 3306:3306 --volume-driver nutanix -v msqldata01:/var/lib/mysql --net=host percona/percona-server:5.6.28
./sysbench --test=tests/db/oltp.lua --oltp_tables_count=16 --oltp_table_size=10000000 --num-threads=16 --mysql-host=127.0.0.1 --mysql-user=root --oltp-read-only=off --max-time=1800 --max-requests=0 --report-interval=10 run
# Links
http://mysqlserverteam.com/mysql-with-docker-performance-characteristics/
https://forums.docker.com/t/benchmarking-a-docker-container/23943/3
http://www.breakage.org/2014/06/06/getting-started-with-performance-analysis-of-docker/
https://github.com/akopytov/sysbench
sysbench --test=/opt/tests/db/oltp.lua --oltp_tables_count=8 --oltp_table_size=10000000 --num-threads=16 --mysql-host=172.18.0.2 --mysql-user=root --oltp-read-only=on --max-time=1800 --max-requests=0 --report-interval=10 run
http://www.breakage.org/2014/06/06/getting-started-with-performance-analysis-of-docker/
https://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench
o setup sysbench db container
either ...
docker volume create --name pgsysdata --driver nutanix --opt sizeMB=200000
pgsysdata
[root@dvm01 ~]# docker volume ls
DRIVER VOLUME NAME
nutanix pgdata01
nutanix pgsysdata
docker-machine create -d nutanix --nutanix-username admin --nutanix-password 'nutanix/4u' --nutanix-endpoint '10.68.64.55:9440' --nutanix-vm-image Container-Host-Image --nutanix-vm-network vlan.68 dvm03
docker-machine ssh dvm03
./start-volume-plugin.sh
docker run -d --name pgsys01 -p5432:5432 --volume-driver nutanix -v pgsysdata:/var/lib/postgresql/data postgres:latest
docker exec -it pgsys01 /bin/bash
or if you need to install additional software
o install vanilla centos 7 vm + isicsi + docker volume driver
docker volume create --name pgsysdata --driver nutanix --opt sizeMB=200000
pgsysdata
docker run -d --name pgsys01 -p5432:5432 --volume-driver nutanix -v pgsysdata:/var/lib/postgresql/data postgres:latest
At VM layer
yum -y install make automake libtool pkg-config libaio-devel vim-common
yum -y install mysql-devel
yum -y install postgresql-devel
yum install -q -y bc blktrace btrfs-progs ethtool gcc git gnuplot hwloc iotop iproute iputils less mailx man-db netsniff-ng net-tools numactl numactl-devel openssh-clients openssh-server passwd perf procps-ng psmisc screen strace tcpdump vim-enhanced wget xauth which
git clone https://github.com/akopytov/sysbench.git
cd sysbench
./autogen.sh
# Add --with-pgsql to build with PostgreSQL support
./configure
make
make install
# find . -name oltp.lua
./root/sysbench/tests/include/oltp_legacy/oltp.lua
./usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua
sysbench --test=oltp --db-driver=mysql --oltp-table-size=2000000 --max-requests=0 --mysql-table-engine=InnoDB --mysql-user=root --mysql-engine-trx=yes --num-threads=1 prepare
docker run --detach --name=test-mysql --env="MYSQL_ROOT_PASSWORD=nutanix" mysql
docker inspect test-mysql | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
mysql -u root -h 172.17.0.2 -P 3306 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>
virsh domjobinfo `<vm_uuid>` --completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment