AKAI TSUKI

System development or Technical something

check index infomation by REST API

infomation

# curl http://localhost:9200/customer?pretty
{
  "customer" : {
    "aliases" : { },
    "mappings" : { },
    "settings" : {
      "index" : {
        "creation_date" : "1514796397799",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "2bDYA53CQp6lvXxoHe_jAQ",
        "version" : {
          "created" : "5040399"
        },
        "provided_name" : "customer"
      }
    }
  }
}
#

settings

# curl http://localhost:9200/customer/_settings?pretty
{
  "customer" : {
    "settings" : {
      "index" : {
        "creation_date" : "1514796397799",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "2bDYA53CQp6lvXxoHe_jAQ",
        "version" : {
          "created" : "5040399"
        },
        "provided_name" : "customer"
      }
    }
  }
}
#

mappings

# curl http://localhost:9200/customer/_mappings?pretty
{
  "customer" : {
    "mappings" : { }
  }
}
#

alias

# curl http://localhost:9200/customer/_alias?pretty
{
  "customer" : {
    "aliases" : { }
  }
}
#

mappings and alias

# curl http://localhost:9200/customer/_mappings,_alias?pretty
{
  "customer" : {
    "mappings" : { },
    "aliases" : { }
  }
}
#

Install Prometheus on CentOS 7

ref. prometheus-rpm/release - Packages - packagecloud.io | packagecloud

Setting yum repository

[root@cent7devops ~]# vi /etc/yum.repos.d/prometheus.repo
[root@cent7devops ~]# cat /etc/yum.repos.d/prometheus.repo
[prometheus]
name=prometheus
baseurl=https://packagecloud.io/prometheus-rpm/release/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey
       https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[root@cent7devops ~]#

install prometheus 2

[root@cent7devops ~]# yum install -y prometheus2.x86_64
*snip*
Installed:
  prometheus2.x86_64 0:2.0.0-2.el7.centos

Complete!
[root@cent7devops ~]#

install node exporter

[root@cent7devops ~]# yum install -y node_exporter.x86_64
*snip*
Installed:
  node_exporter.x86_64 0:0.15.1-1.el7.centos

Complete!
[root@cent7devops ~]#

firewall setting

[root@cent7devops ~]# firewall-cmd --zone=public --add-port=9090/tcp
success
[root@cent7devops ~]# firewall-cmd --zone=public --add-port=9090/tcp --permanent
success
[root@cent7devops ~]# firewall-cmd --reload
success
[root@cent7devops ~]#

[root@cent7devops ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources:
  services: dhcpv6-client ssh
  ports: 9090/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[root@cent7devops ~]#

start Prometheus

[root@cent7devops ~]# systemctl start prometheus

access to prometheus web

f:id:akai_tsuki:20171203184946p:plain

start Node exporter

[root@cent7devops ~]# systemctl start node_exporter

edit Prometheus config file

[root@cent7devops ~]# cp -p /etc/prometheus/prometheus.yml{,.org}
[root@cent7devops ~]# vi /etc/prometheus/prometheus.yml
[root@cent7devops ~]# diff /etc/prometheus/prometheus.yml.org /etc/prometheus/prometheus.yml
29c29
<       - targets: ['localhost:9090']
---
>       - targets: ['localhost:9090', 'localhost:9100']
[root@cent7devops ~]#

reload

[root@cent7devops ~]# systemctl reload prometheus

check Graph for node_memory_Active

f:id:akai_tsuki:20171203190029p:plain

I would like to know Harbor.

Information Link about Harbor

github.com

Harbor™ by VMware®

announced Grafeas

GrafeasをGoogleIBMなど8社が共同開発

jp.techcrunch.com

github.com

install Docker version 17.09.0-ce

# yum install -y yum-utils \
>   device-mapper-persistent-data \
>   lvm2
*snip*
Installed:
  yum-utils.noarch 0:1.1.31-42.el7

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_2.3           python-chardet.noarch 0:2.2.1-1.el7_1
  python-kitchen.noarch 0:1.1.1-5.el7

Complete!
#
# yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
#
# yum install docker-ce
*snip*
Installed:
  docker-ce.x86_64 0:17.09.0.ce-1.el7.centos

Dependency Installed:
  audit-libs-python.x86_64 0:2.7.6-3.el7             checkpolicy.x86_64 0:2.5-4.el7
  container-selinux.noarch 2:2.21-2.gitba103ac.el7   libcgroup.x86_64 0:0.41-13.el7
  libseccomp.x86_64 0:2.3.1-3.el7                    libsemanage-python.x86_64 0:2.5-8.el7
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3               policycoreutils-python.x86_64 0:2.5-17.1.el7
  python-IPy.noarch 0:0.75-6.el7                     setools-libs.x86_64 0:3.3.8-1.1.el7

Complete!
#
# yum list docker-ce --showduplicates | sort -r
 * updates: ftp.riken.jp
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
 * extras: ftp.riken.jp
docker-ce.x86_64            17.09.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos            @docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
 * base: ftp.riken.jp
Available Packages
#
# systemctl start docker
#
# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
5b0f327be733: Pull complete
Digest: sha256:07d5f7800dfe37b8c2196c7b1c524c33808ce2e0f74e7aa00e603295ca9a0972
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

#
# docker --version
Docker version 17.09.0-ce, build afdb6d4
#

start gitlab-ce by docker

ref

docs.gitlab.com

Command

docker run --detach \
 --hostname gitlab.example.com \
 --publish 443:443 --publish 80:80 --publish 1022:22 \
 --name gitlab \
 --restart always \
 --volume /srv/gitlab/config:/etc/gitlab \
 --volume /srv/gitlab/logs:/var/log/gitlab \
 --volume /srv/gitlab/data:/var/opt/gitlab \
 gitlab/gitlab-ce:latest

pull image of gitlab-ce

# docker pull gitlab/gitlab-ce
Using default tag: latest
latest: Pulling from gitlab/gitlab-ce
*snip*
Status: Downloaded newer image for gitlab/gitlab-ce:latest
#
# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
gitlab/gitlab-ce    latest              453d64ae84c7        11 days ago         1.28GB
hello-world         latest              05a3bd381fc2        4 weeks ago         1.84kB
#

start gitlab

# docker run --detach \
>  --hostname gitlab.example.com \
>  --publish 443:443 --publish 80:80 --publish 1022:22 \
>  --name gitlab \
>  --restart always \
>  --volume /srv/gitlab/config:/etc/gitlab \
>  --volume /srv/gitlab/logs:/var/log/gitlab \
>  --volume /srv/gitlab/data:/var/opt/gitlab \
>  gitlab/gitlab-ce:latest
49834fc47143bd4bb50a8a203d00f4d8171c45d3097c9acd65cb6350ab34a955
#

use NFS on CentOS 7

environment

hostname ip node
cent7no12 172.16.10.212 nfs client
cent7no41 172.16.10.241 nfs server

setting for nfs-server

on cent7no41

# yum -y install nfs-utils

# vi /etc/idmapd.conf

Domain = cent7no41

# mkdir -p /home/nfs
# chmod a+w /home/nfs
# ls -ld /home/nfs
drwxrwxrwx 4 root root 123 May 10 01:12 /home/nfs
#
# vi /etc/exports
# cat /etc/exports
/home/nfs 172.16.10.0/24(rw)
#

start nfs-server

on cent7no41

# systemctl start rpcbind nfs-server 
# systemctl enable rpcbind nfs-server 

setting for nfs-client and mount

on cent7no12

# yum -y install nfs-utils
# mkdir -p /mnt/nfs
# mount -t nfs 172.16.10.241:/home/nfs /mnt/nfs
# nfsstat -m
/mnt/nfs from 172.16.10.241:/home/nfs
 Flags: rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=172.16.10.212,local_lock=none,addr=172.16.10.241

# df -hT
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/cl-root     xfs        35G  1.6G   34G   5% /
devtmpfs                devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                   tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                   tmpfs     1.9G   17M  1.9G   1% /run
tmpfs                   tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  182M  833M  18% /boot
tmpfs                   tmpfs     380M     0  380M   0% /run/user/0
172.16.10.241:/home/nfs nfs4       35G  3.3G   32G  10% /mnt/nfs
#