Obsidian/Recognition/Programing/ELK/ELK 폐쇄망 설치(New).md

110 lines
2.3 KiB
Markdown

```shell
# 폴더 생성 및 설치 파일 이동
## local : C:\kdggmtwork\스마트계류장\3.개발관련문서\배포및설치\ELK
# 도커 설치
cd /home/gmt/SACP-INSTALL/Docker/
tar -xvf docker-20.10.21.tgz
chown -R root:root docker
cd docker/
mv * /usr/bin/
# 도커 설치 확인
docker --version
# 도커 실행
dockerd &
# 도커 compose 설치
cd /home/gmt/SACP-INSTALL/Docker/
cp docker-compose /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 도커 compose 설치 확인
docker-compose --version
# ELK 도커 이미지 로드
docker load -i /home/gmt/SACP-INSTALL/docimgs/docimg_elasticserch.tar
docker load -i /home/gmt/SACP-INSTALL/docimgs/docimg_kibana.tar
docker load -i /home/gmt/SACP-INSTALL/docimgs/docimg_logstash.tar
# 도커용 로그 폴더 생성
mkdir /home/gmt/elk_data
mkdir /home/gmt/Docker-Data
# 도커 데몬 서비스 등록
nano /etc/systemd/system/docker.service
#####################################################
[Unit]
Description=Systemd Docker Daemon
[Service]
Type=simple
ExecStart=dockerd --data-root=/home/gmt/Docker_data
Restart=on-failure
[Install]
WantedBy=multi-user.target
#####################################################
# 도커 서비스 실행전 도커 데몬 프로세스 종료
ps -ef | grep docker
kill -9 [PID]
# 도커 서비스 실행
systemctl daemon-reload
systemctl enable docker
systemctl status docker
# ELK 도커 설치
cd /home/gmt/SACP-INSTALL/elk/
docker-compose build && docker-compose up -d
# Elasticsearch 로그 확인
docker logs es01
docker exec -it es01 bash
docker exec -it --user root es01 bash
```
- 오류시 확인
```shell
# ELK 실행 오류시
mkdir /home/gmt/elk_data/backup
nano /home/gmt/elk_data/es01/nodes/0/node.lock
chmod -R 755 /home/gmt/elk_data
# JAVA 설치 확
tar -xvf openjdk-18+36_linux-x64_bin.tar.gz
nano /etc/profile
#####################################################
export JAVA_HOME=/home/gmt/SACP-INSTALL/java/jdk-18
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib:$CLASS_PATH
#####################################################
source /etc/profile
echo $JAVA_HOME
java -version
# 도커 서비스 실행 안되는 경우
cd /var/lib/docker/
rm -rf /var/lib/docker
```