Installing Server Node
ย
Required Hardware Spec.
Single Server Node ๊ธฐ์ค
์๋๋ InfluxDB์ official ๊ถ๊ณ ์ฌ์์ ์ฐธ๊ณ ํ normal workload(agent ๋น ํ๋์ ์ดํ๋ฆฌ์ผ์ด์
์ ๋ชจ๋ํฐ๋ง)์ ๋ํ ๊ธฐ์ค ์
๋๋ค.
๋ํ, CH Portalย + InfluxDB + Kapacitor + SaltStack Server๊ฐ ํ ๋์ ์๋ฒ์ ํ์ฌ๋๋ ๊ฒ์ผ๋ก ์ฐ์ ํฉ๋๋ค.
๋จ, ๊ฐ ์๋ฒ ๋ฐ ์์ด์ ํธ ์ปดํฌ๋ํธ๋ค(Introduction | Components Architecture)์ workload๋ ๋ฐ๋ผ ๊ฐ๋ณ์ ์
๋๋ค.
100 ~ 250 agent nodes: 8core, 16GB Ram
~ 500 agent nodes: 16core, 32GB Ram
~ 1000 agent nodes: 24core+, 48GB+ Ram
๋ํ, Kapacitor(data processing component)์ ๊ฒฝ์ฐ๋ jobํ ๋น ๊ฐ์๋ ํ๋ก์ธ์ฑ ๋ถํ์ ๋ฐ๋ผ ์ ์ฒด workload๋ ์ฐจ์ด๊ฐ ํด ์ ์์ต๋๋ค.
์ด์ ์ค ์ค์ ๋ถํ๋์ ๋ฐ๋ผ ๊ฐ ์ปดํฌ๋ํธ๋ฅผ ๋ถ๋ฆฌ-ํ์ฅ(Scale-out)ํ๋ ๋ฐฉ๋ฒ์ผ๋ก ๊ถ๊ณ ํฉ๋๋ค.
OS
CentOS 7 x86_64 ๊ธฐ์ค
CloudHub์์ ์ฌ์ฉ๋๋ Port
๊ฐ๋ ๋
์ฐธ๊ณ ์๋์์ ํ์ดํ๋ฅผ ๋ฐ๋ ์ชฝ์ด Port Listening ์ํ๋ก ํ๊ธฐํจ.
External Ports: Internet ๊ตฌ๊ฐ
443: CloudHub Portal์์ ์ฌ์ฉํ๋ ์น ํฌํธ.
Internal Ports (Backend Server ๊ฐ): Trusted Network ๊ตฌ๊ฐ
8000 : Salt-API Server - CH Server์ ๋ฐ์ดํฐ ์ก์์ .
9094 : Kapacitor - InfluxDB์ ๋ฐ์ดํฐ ์ก์์ .
Intermediate Ports (Agent โ๏ธ Backend Server ๊ฐ): Semi-Trusted Network ๊ตฌ๊ฐ
์๋ ํฌํธ๋ค์ ๋ชจ๋ํฐ๋ง ๋์ ํธ์คํธ๋ค(MO: Managed Objects)๊ณผ์ ํต์ ์ ์ฌ์ฉ๋ฉ๋๋ค.
443 ํฌํธ๋ฅผ ์ ์ธํ๊ณ ๋ ๋ณด์ ์ํ์ด ๋ ์ ์์ผ๋ฏ๋ก,
Source IP ํน์ ๋์ญ์ผ๋ก ACL์ ์ฑ
์ ์ฌ์ฉํ ํ์๊ฐ ์์ต๋๋ค.
์๋ ์ค์ ์์์ ๊ฐ์ด firewalld filter๋ฅผ ์ฌ์ฉํ๊ฑฐ๋, ํน์ tcp_wrappers ๋ฑ์ ์ฌ์ฉํ์ฌ hosts.allow, hosts.deny ๋ฑ์ ACL์ ์ค์ ํ ์ ์์ต๋๋ค.
(tcp_wrappers ์ค์ ๋ฐฉ๋ฒ์ ์ฌ๊ธฐ์๋ ๋ค๋ฃจ์ง ์์ต๋๋ค. ํ์ํ ๊ฒฝ์ฐ, ์ธํฐ๋ท ๊ฒ์์ ํตํ์ฌ ์ฝ๊ฒ ์ฌ์ฉ๋ฒ์ ์ป์ ์ ์์ผ๋ ์ฐธ๊ณ ๋ฐ๋๋๋ค.)
4505-4506 : Salt-Master - Salt-Minion๊ณผ ๋ฐ์ดํฐ ์ก์์ .
8086 : InfluxDB - telegraf๋ก๋ถํฐ ๋ฐ์ดํฐ ์์ .
์๋๋ firewalld
์ค์ ํ์ผ ์์์ด๋ฉฐ,
์ฃผ์ ๋ฌผ๋ฆฌ์ ์ธ ๋ณด์ ์ฅ๋น๋ฅผ ๋ฐ๋ก ์ฌ์ฉํ์ฌ ์ค์ ํ ๊ฒฝ์ฐ๋ ์ ์ค๋ช
ํ ์ฉ๋์ ๋ด์ฉ์ ๋ง๊ฒ ACL์ ์ค์ ํ์ฌ ์ฌ์ฉํ์ฌ์ผ ํฉ๋๋ค.
<!-- /etc/firewalld/zones/public.xml -->
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas.</description>
<service name="ssh"/>
<service name="dhcpv6-client"/>
<port protocol="tcp" port="443"/>
<rule family="ipv4">
<source address="xxx.xxx.xxx.0/24"/>
<port protocol="tcp" port="4505-4506"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="xxx.xxx.xxx.xxx"/>
<port protocol="tcp" port="8000"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="xxx.xxx.xxx.xxx"/>
<port protocol="tcp" port="8086"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="xxx.xxx.xxx.xxx"/>
<port protocol="tcp" port="9094"/>
<accept/>
</rule>
</zone>
Install Pre-required Packages
Setting InfluxDB and Kapacitor containers via Docker Compose
[์ฃผ์] CloudHub์์ ํธํ์ฑ ์ ์ง
CloudHub๋ ์ InfluxDB์ Kapacitor์ ์์์ ๋ฒ์ ์๋ ์ํ์ ํธํ๋์ง ์์ ์ ์์ต๋๋ค.
๋ฐ๋์ CloudHub Release(https://github.com/snetsystems/cloudhub/releases)ํ์ด์ง์์ ์ค์นํ CloudHub ๋ฒ์ ๊ณผ ํธํ๋๋ InfluxDB์ Kapacitor ๋ฒ์ ์ ํ์ธํ ํ, ํด๋น ๋ฒ์ ์ผ๋ก ์ค์นํด์ผ ํฉ๋๋ค.
์>
InfluxDB๊ฐ 1.8.0, Kapacitor๊ฐ 1.5.4๋ผ๋ฉด,
์๋ 6๋ฒ์ ์ํํ ํ, sandbox/.env ํ์ผ์ ์๋์ ๊ฐ์ด ์์ ํฉ๋๋ค.INFLUXDB_TAG=1.8.0
KAPACITOR_TAG=1.5.4
์ดํ, ์๋ 7๋ฒ์ ์ํํฉ๋๋ค.
Docker ์ค์น ํ์ธ
๋ฒ์ : Docker version 18.09.4 ์ด์
$ docker --version Docker version 18.09.4, build d14af54266
๋ฒ์ ์ด ๋ฎ์ผ๋ฉด ์ด์ ๋ฒ์ ์ ์ญ์ ํ ์ค์น
์ด์ ๋ฒ์ ์ญ์
$ yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
์ ์ฅ์ ์ค์ ๋ฐ ์ถ๊ฐ
$ yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 $ yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
Install Docker Engine - Community
$ yum install docker-ce docker-ce-cli containerd.io
Docker log rotation ์ค์
logrotate์ ์ฌ์ฉํ์ฌ Docker Log๋ฅผ ๊ด๋ฆฌ ํฉ๋๋ค.
Log ํ์ผ ๊ฒฝ๋ก :
/var/lib/docker/containers/*/*.log
Log ์ค์ ํ์ผ :
$ vim /etc/logrotate.d/docker-container
/var/lib/docker/containers/*/*.log { daily rotate 7 missingok dateext compress notifempty }
daily : ๋งค์ผ log๋ฅผ rotate ํฉ๋๋ค.
rotate 7 : ์ต๋ log.1, log.2 ๋ฑ 7๊ฐ์ ํ์ผ์ ๋ณด๊ดํฉ๋๋ค.
missingok : log๊ฐ ์๋ ๊ฒฝ์ฐ ์๋ฌ ์์ด ๋ค์ rotate๋ก ๋์ด๊ฐ๋๋ค.
dateext : log ํ์ผ์ YYYYMMDD ํ์์ ํ์ฅ์๋ฅผ ์ถ๊ฐํฉ๋๋ค.
compress : ์ด์ log๋ฅผ ์์ถํฉ๋๋ค.
notifempty :ย ย log ๋ด์ฉ์ด ์์ผ๋ฉด rotation ํ์ง ์์ต๋๋ค.
Docker ์คํ
$ systemctl enable docker $ systemctl start docker $ systemctl status docker โ docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2020-03-09 05:30:36 EDT; 3s ago Docs: https://docs.docker.com Main PID: 2036 (dockerd) Tasks: 8 Memory: 42.1M CGroup: /system.slice/docker.service โโ2036 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ... ... Hint: Some lines were ellipsized, use -l to show in full.
Docker Compose ์ค์น ํ์ธ
๋ฒ์ : Docker Compose version 1.24 ์ด์
$ docker-compose --version docker-compose version 1.24.0, build 0aa59064
๋ฒ์ ์ด ๋ฎ๊ฑฐ๋ ๋ฏธ ์ค์น ์ Docker Compose ์ค์น
ํ์ผ ๋ค์ด๋ก๋
$ curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
๋ค์ด๋ก๋ ํ์ผ์ ๊ถํ ์ ์ฉ
$ sudo chmod +x /usr/local/bin/docker-compose
๋ฒ์ ํ์ธ
$ docker-compose --version docker-compose version 1.25.4, build 8d51620a
Git ์ค์น
$ yum install -y git
Snetsystems/Sandbox Download
$ cd {Sandbox ๋ค์ด๋ก๋ ํ ๋๋ ํ ๋ฆฌ ์ด๋} $ git clone https://github.com/snetsystems/sandbox.git
Sandbox ์คํ
$ cd sandbox $ ./sandbox up Using latest, stable releases Spinning up Docker Images... If this is your first time starting sandbox this might take a minute... Creating network "sandbox_default" with the default driver Building influxdb Step 1/2 : ARG INFLUXDB_TAG Step 2/2 : FROM influxdb:$INFLUXDB_TAG latest: Pulling from library/influxdb c0c53f743a40: Downloading [=================================> ] 30.81MB/45.38MB c0c53f743a40: Pull complete 66997431d390: Pull complete ... ... Successfully built a59cd84d6569 Successfully tagged kapacitor:latest Creating sandbox_influxdb_1 ... done Creating sandbox_kapacitor_1 ... done Opening tabs in browser...
Setting SaltStack for master
[์ฃผ์]
ํ์๋ง(Off internet) ์ผ ๊ฒฝ์ฐ, yum ๋ช
๋ น์ --disablerepo=* --enablerepo=cloudhubrepo
์ต์
์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
Yum install
Salt official installation guide(https://repo.saltproject.io/3001.html#rhel)
โ Enter into the linked page, and then choose โRedhat / CentOS 7 PY3โ tab button.
SaltStack ์ ์ฅ์ ๋ฑ๋ก
$ yum install -y epel-release $ rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/archive/3001.4/SALTSTACK-GPG-KEY.pub $ curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/archive/3001.4.repo | sudo tee /etc/yum.repos.d/salt.repo $ yum clean expire-cache
Salt-Master, Salt-API, Salt-Minion ์ค์น
$ yum install -y salt-master salt-api salt-minion
Config ์ค์
Salt-Master์ Config ์ Salt-API์ Config ํ์ผ์ ์ค์ ํด์ผ ํฉ๋๋ค.
Salt-Master :
$ vim /etc/salt/master.d/master.conf
์ฃผ์ Host์ ์ฌ๋ฌ Interface๊ฐ ์์ ๊ฒฝ์ฐ Salt-Minion๊ณผ ์ฐ๊ฒฐ ๊ฐ๋ฅํ ๋คํธ์ํฌ Interface IP๋ก ์ค์ ํด์ผ ํฉ๋๋ค.
ex) interface: 61.254.65.58
์๋ ์์ ๊ฐ์ด any(0.0.0.0)๋ก ์ค์ ํด๋ master โ๏ธ minion ๊ฐ ํต์ ์ ๋ฌธ์ ๊ฐ ์์ผ๋,
CloudHub UI์์ ์ํ์ง ์๋ IP๋ก ํ์๋ ์ ์์ต๋๋ค.## log_level ## # One of 'garbage', 'trace', 'debug', info', 'warning'(default), 'error', 'critical'. log_level: info ##### Primary configuration settings ##### ########################################## # The address of the interface to bind to: interface: 0.0.0.0 # The tcp port used by the publisher: publish_port: 4505 # Allow minions to push files to the master. This is disabled by default, for # security purposes. # file_recv: True ##### State System settings ##### ########################################## # The state system uses a "top" file to tell the minions what environment to # use and what modules to use. The state_top file is defined relative to the # root of the base environment as defined in "File Server settings" below. state_top: top.sls ##### File Server settings ##### ########################################## # Salt runs a lightweight file server written in zeromq to deliver files to # minions. This file server is built into the master daemon and does not # require a dedicated port. # The file server works on environments passed to the master, each environment # can have multiple root directories, the subdirectories in the multiple file # roots cannot match, otherwise the downloaded files will not be able to be # reliably ensured. A base environment is required to house the top file. file_roots: base: - /srv/salt/prod qa: - /srv/salt/qa - /srv/salt/prod dev: - /srv/salt/dev - /srv/salt/qa - /srv/salt/prod # File Server Backend # # Salt supports a modular fileserver backend system, this system allows # the salt master to link directly to third party systems to gather and # manage the files available to minions. Multiple backends can be # configured and will be searched for the requested file in the order in which # they are defined here. The default setting only enables the standard backend # "roots" which uses the "file_roots" option. fileserver_backend: - roots ##### Security settings ##### ########################################## # The external auth system uses the Salt auth modules to authenticate and # validate users to access areas of the Salt system. external_auth: pam: saltdev: - .* - '@runner' - '@wheel' - '@jobs' # Allow eauth users to specify the expiry time of the tokens they generate. # A boolean applies to all users or a dictionary of whitelisted eauth backends # and usernames may be given. token_expire_user_override: pam: - saltdev ##### API Server settings ##### ########################################## rest_cherrypy: port: 8000 disable_ssl: True
Salt-Minion :
$ vim /etc/salt/minion.d/minion.conf
## log_level ## # One of 'garbage', 'trace', 'debug', info', 'warning'(default), 'error', 'critical'. log_level: info master: <master ip address> id: <์ ์ผํ minion id ์ค์ ํด์ผ ํ๋ฉฐ, ์๋ต ์, hostname = minion id>
๊ณ์ ์์ฑ ๋ฐ ํจ์ค์๋ ์ค์
์๋ ์ถ๊ฐ๋ password๋ ์ถํ salt-api authentication์ ์ํpam_token
๋ฅผ ๋ฐ๊ธ ๋ฐ๋๋ฐ ์ฐ์ด๋ฏ๋ก, ์ ๊ธฐ์ตํด๋์ด์ผ ํฉ๋๋ค.$ useradd saltdev $ passwd <password> Changing password for user saltdev. New password:
์๋น์ค ์์
$ systemctl enable salt-master $ systemctl start salt-master $ systemctl enable salt-api $ systemctl start salt-api $ systemctl enable salt-minion $ systemctl start salt-minion
For off internet
์๋จ ์ค์น ๊ณผ์ ์ ์ธํฐ๋ท์ด ํ์ฉ๋๋ ํ๊ฒฝ์์์ Pre-required Packages ์ค์น ๋ฐฉ๋ฒ์ ๋๋ค.
์ธํฐ๋ท์ด ์๋๋ ํ์๋ง ํ๊ฒฝ์์ Package Deployment on Private Network(Server)์ค์น ๋ฐฉ๋ฒ ์ ๋๋ค.
Download telegraf into salt file_roots
path on salt-master
์๋ ๋งํฌ์์ ์ค์นํ๊ณ ์ ํ๋ ๋ฒ์ ์ ๋ค์ด๋ก๋ ํ ์ ์์ต๋๋ค.
Download URL: https://github.com/snetsystems/telegraf/releases
ํน๋ณํ ์ธ๊ธ์ด ์๋ค๋ฉด, telegraf
์ต์ ๋ฒ์ ์ ์ค์นํฉ๋๋ค.
ํ์๋ง์ธ ๊ฒฝ์ฐ USB ๋๋ CD์์ telegraf
rpm ํ์ผ์ ์๋ ๊ฒฝ๋ก์ ๋ณต์ฌํฉ๋๋ค.
$ย mkdirย -pย /srv/salt/prod/telegrafย ย ย ย ย ย ย ย ย ย # Telegraf package path
$ย cdย /srv/salt/prod/telegraf
$ wget https://github.com/snetsystems/telegraf/releases/download/v1.19.0-snet/telegraf-1.19.0-snet-1.x86_64.rpm
Install CloudHub Portal
Download
์๋ ๋งํฌ์์ ์ค์นํ๊ณ ์ ํ๋ ๋ฒ์ ์ ๋ค์ด๋ก๋ ํ ์ ์์ต๋๋ค.
Download URL: https://github.com/snetsystems/cloudhub/releases
๊ฐ์ด๋์์ ์ฌ์ฉ๋๋ CloudHub์ ๋ฒ์ ๊ณผ ํ์ฌ ์ต์ ๋ฆด๋ฆฌ์ฆ ๋ฒ์ ์ ์ฐจ์ด๊ฐ ์์ ์ ์์ต๋๋ค๋ง,
์ค์น ๋ฐฉ๋ฒ์ ๋์ผํฉ๋๋ค.
Install CloudHub admin portal package
์๋์์ ์ค์ ๋ ์คํ ์ต์ ๋ค์ ์ค์น ๊ณผ์ ์ ๊ด๊ณ๋ ์์์ด๋ฉฐ, Production ํ๊ฒฝ์์ CloudHub๋ฅผ ์คํํ ๋๋ Basic Configure CloudHub ๋ฅผ ์ฐธ๊ณ ํ์ฌ ์ค์ ํด์ผ ํฉ๋๋ค.
์ค์น๋ช ๋ น์ด
$ sudo yum localinstall cloudhub-0.9.1~17fe47a.x86_64.rpm
Log ํ์ผ
service๋ก ๋ฐ๋ชฌ ์คํ ์ log file :
/var/log/cloudhub
systemd๋ก ๋ฐ๋ชฌ ์คํ ์ log file:
/var/log/messages
Environment or Argument file path
์คํ(help) ์ต์
$ cloudhub -h
ํ์ผ :
/etc/default/cloudhub
Argument ์ค์ : ์> 61.250.122.xx
$ cat /etc/default/cloudhub CLOUDHUB_OPTS="-l=debug \ --auth-duration=0 \ -t=74c1e9e2450886060b5bf736b935cd0bf960837f \ -i=<client-id> \ -s=<client-secret> \ -u=salt:http://61.250.122.xx:8000/run \ -k=salt:<salt-token>"
์๋น์ค ์์/์ ์ง/์ฌ์์
$ sudo systemctl {start|stop|restart} cloudhub
์๋น์ค ํ์ธ
$ systemctl status cloudhub.service โ cloudhub.service Loaded: loaded (/usr/lib/systemd/system/cloudhub.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-02-20 03:55:04 EST; 1s ago Main PID: 23498 (cloudhub) Tasks: 5 Memory: 26.9M CGroup: /system.slice/cloudhub.service โโ23498 /usr/bin/cloudhub Feb 20 03:55:04 localhost.localdomain systemd[1]: Started cloudhub.service. Feb 20 03:55:04 localhost.localdomain cloudhub[23498]: time="2020-02-20T03:55:04-05:00" level=info msg="Serving CloudHub at http://[::]:8888" component=server
Enabling HTTPS on CloudHub Portal
http๊ฐ ๊ธฐ๋ณธ์ผ๋ก ์ค์ ๋์ด ์์ผ๋ฉฐ https๋ก ๋ณ๊ฒฝ ํ๋ ค๋ฉด cloudhub.service ์ค๋จ ํ ์ค์ ํ์ผ์ ์์ ํ๊ณ 'systemctl daemon-reload'๋ฅผ ํ์ฌ ์๋น์ค๋ฅผ ์ฌ์์ ํฉ๋๋ค.
$ cat /etc/systemd/system/multi-user.target.wants/cloudhub.service [Unit] After=network-online.target [Service] User=root Group=root Environment="HOST=0.0.0.0" #Environment="PORT=8888" Environment="PORT=443" Environment="TLS_CERTIFICATE=/usr/lib/cloudhub/key/cloudhub_self_signed.pem" Environment="BOLT_PATH=/var/lib/cloudhub/cloudhub-v1.db" Environment="CANNED_PATH=/usr/share/cloudhub/cloudhub-canned" Environment="PROTOBOARDS_PATH=/usr/share/cloudhub/cloudhub-protoboards" EnvironmentFile=-/etc/default/cloudhub ExecStart=/usr/bin/cloudhub $CLOUDHUB_OPTS KillMode=control-group Restart=on-failure [Install] WantedBy=multi-user.target
ย