Tuesday, November 8, 2016

Influxdb Installation and Playing


InfluxDB Testing


Get influxdb apt repository

wget -O- https://repos.influxdata.com/influxdb.key | apt-key add -
root@influxdb:~# apt-key list

pub   4096R/2582E0C5 2015-09-28
uid                  InfluxDB Packaging Service <support@influxdb.com>
sub   4096R/87F70D56 2015-09-28
root@influxdb:~# source /etc/lsb-release
root@influxdb:~# echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list

Update Repository and install influxdb

root@influxdb1:~#apt-get update
root@influxdb1:~# apt-get -y install influxdb
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 174 not upgraded.
Need to get 17.8 MB of archives.
After this operation, 64.0 MB of additional disk space will be used.
Fetched 17.8 MB in 57s (308 kB/s)
Selecting previously unselected package influxdb.
(Reading database ... 49929 files and directories currently installed.)
Preparing to unpack .../influxdb_1.0.2-1_amd64.deb ...
Unpacking influxdb (1.0.2-1) ...
Processing triggers for man-db ( ...
Setting up influxdb (1.0.2-1) ...
 Adding system startup for /etc/init.d/influxdb ...
   /etc/rc0.d/K20influxdb -> ../init.d/influxdb
   /etc/rc1.d/K20influxdb -> ../init.d/influxdb
   /etc/rc6.d/K20influxdb -> ../init.d/influxdb
   /etc/rc2.d/S20influxdb -> ../init.d/influxdb
   /etc/rc3.d/S20influxdb -> ../init.d/influxdb
   /etc/rc4.d/S20influxdb -> ../init.d/influxdb
   /etc/rc5.d/S20influxdb -> ../init.d/influxdb

Start playing

Use 8086 port.

Create DB first

root@influxdb1:~# curl -X POST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mydb"

Write data

root@influxdb1:~# curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server02 value=0.67'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: bef013e7-a593-11e6-8004-000000000000
X-Influxdb-Version: 1.0.2
Date: Tue, 08 Nov 2016 09:14:26 GMT

Query data

root@influxdb1:~# curl -i 'http://localhost:8086/query?db=mydb' --data-urlencode "q=SELECT value FROM cpu_load_short"
HTTP/1.1 200 OK
Connection: close
Content-Type: application/json
Request-Id: 0707f706-a594-11e6-8007-000000000000
X-Influxdb-Version: 1.0.2
Date: Tue, 08 Nov 2016 09:16:27 GMT
Transfer-Encoding: chunked


Monday, November 7, 2016

Numa Setting


Numa Setting

What is a Numa

Simplly said, Numa has a share memory charachtoristic.
Numa node means share the same pool of memory.
So if a process running in same Numa node, it will get better performance.
Let's see it.

Check Server Numa Node

To get Numa node

[root@openstackha11 ~]# cat /sys/devices/system/node/
has_cpu            node0/             possible
has_memory         node1/             power/
has_normal_memory  online             uevent

To get Numa node's CPU

[root@openstackha11 ~]# cat /sys/devices/system/node/node0/cpulist
[root@openstackha11 ~]# cat /sys/devices/system/node/node1/cpulist

Set Numa for a Process

Set up a Process to a CPU range(Numa Node)

[root@openstackha11 ~]# taskset -cp 6-11,18-23 24122
pid 24122's current affinity list: 0-23
pid 24122's new affinity list: 6-11,18-23
You have new mail in /var/spool/mail/root

where 6-11,18-23 obtained by numa node.

Tuesday, November 1, 2016