ELK + MetricBeat System Monitoring Architecture 아래와 같은 구성도로 Monitoring System을 구축한다. 총 세 대의 머신으로 ELK 클러스터를 구성하며 metricbeat는 agent로서 서버 클러스터에는 설치될 필요가 없다. hostname components node1.elk elasticsearch, logstash, kibana node2.elk elasticsearch node3.elk elasticsearch 설치 사전 준비 JDK 1.8 이상 kernel vm.max_map_count = 262144 user limit elastic soft nofile 65536 elastic hard nofile […]
Let’s Encrypt
Let’s Encrypt SSL/TLS, HTTPS 암호화를 위한 인증서를 무료로 발급 가능. mozila, cisco, chrome 등이 참여하는 opensource certbot client 설치 git clone 을 이용하거나 소스를 내려받아 바로 사용할 수 있다. git clone https://github.com/letsencrypt/letsencrypt 또는 wget https://github.com/certbot/certbot/archive/master.zip 명령으로 소스를 내려받아 압축을 풀고 해당 디렉토리로 들어가서, letsencrypt-auto 쉘 스크립트를 실행하면 sudoer 또는 root 권한이 있는 사용자인지 확인한 뒤 […]
[Python] Command Line Arguments
Python Command-Line Arguments sys 모듈 이용 #!/bin/python import sys print (“\nNumber of arguments: “, len(sys.argv),”\n”) print (“Type of sys.argv: “, type(sys.argv),”\n”) print (“Arguments: “, sys.argv,”\n”) for i in range(len(sys.argv)): print(i,type(sys.argv[i]),sys.argv[i]) print () ./cmd_lagrs.py one 2 three "four five six" 명령으로 위 프로그램을 실행하면 Number of arguments: 5 Type of sys.argv: <class ‘list’> Arguments: [‘./cmd_lagrs.py’, ‘one’, […]
[Python] 파일 입출력
Python 파일 입출력 기본 함수인 open() 을 이용하여 파일 입출력이 가능하다. help(open) open(file, mode=’r’, buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Open file and return a stream. Raise IOError upon failure. file 유일하게 필수 입력사항이며 파일 경로를 지정해준다. mode 읽기/쓰기에 대한 상세 모드를 설정한다. 기본값은 ‘rt’ 이며 텍스트파일을 읽는 모드이다. 어떠한 작업을 수행하는지에 따라 ‘r’,’w’,’a’ 문자와 […]
[Kafka] Producer & Consumer Sample
Building Kafka Producer & Consumer Application Using Maven Maven 설치 JAVA만 준비돼 있다면 maven project 사이트에서 pre-compiled binary 받아서 그대로 사용하면 됨. apache maven binary 다운로드 wget http://mirror.navercorp.com/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz 환경 변수 설정 # JDK ENV export JAVA_HOME=/app/jdk export PATH=$JAVA_HOME/bin:$PATH # MAVEN ENV export PATH=/app/maven/bin:$PATH 설치 압축 해제 tar -xvzf apache-maven-3.5.4-bin.tar.gz -C /app/maven 경로 설정 cd /app/maven […]
[Kafka] Console Script 사용하기
Kafka Console Script 사용하기 kafka-topics.sh Create New Topic ‘test’ 라는 이름의 topic 생성 kafka-topics.sh \ –create –zookeeper node1.big:2181,node2.big:2181,node3.big:2181 \ –replication-factor 1 –partitions 1 \ –topic test Get List of Topics from Kafka Cluster kafka-topics.sh \ –list –zookeeper node1.big:2181,node2.big:2181,node3.big:2181 kafka-console-producer.sh console-producer 이용하여, bash 환경에서 표준 입력을 통해 ‘test’라는 topic에 message publish kafka-console-producer.sh \ –broker-list node7.big:9092,node8.big:9092 –topic […]
[Kafka] kafka1.1 설치
Apache Kafka 설치하기 시스템 사용자 profile 설정 # JDK ENV export JAVA_HOME=/app/jdk export PATH=$JAVA_HOME/bin:$PATH export LD_LIBRARY_PATH=$JAVA_HOME/lib:$LD_LIBRARY_PATH # KAFKA ENV export PATH=/app/kafka/bin:$PATH export LOG_DIR=/logs/kafka # Kafka 데몬의 로그 경로 alias startKafka=’kafka-server-start.sh -daemon /app/kafka/config/server.properties’ alias stopKafka=’kafka-server-stop.sh’ # USER ENV set -o vi 바이너리 다운로드 wget http://mirror.apache-kr.org/kafka/1.1.1/kafka_2.11-1.1.1.tgz 바이너리 압축 해제 tar -xvf kafka_2.11-1.1.1.tgz -C /app/kafka/1.1.1 sybolic link 생성 […]
[Kafka] Apache Kafka
Apache Kafka Introduction 이번에 직접 사용해보니.. Message Queue Open Source Framework로서 kafka를 많이들 사용하는 것 같다. 기본적으로 Producer/Consumer Application 을 개발해서 사용해야 하는데 많이 사용하다 보니 관련 자료가 많고 Hadoop, Spark, 여러 수집기 등에서 Plugin을 제공한다. 많이 쓰고 자료가 많아서 kafka를 이용하는 것도 좋은 이유인 것 같다. 다음 두가지 이유가 직접 느낀 좋은 점 Consumer는 […]
[Zookeeper] zookeeper 3.x 설치
Zookeeper 설치 Zookeeper 소개 분산 시스템을 설계 하다보면, 가장 문제점 중의 하나가 분산된 시스템 간의 정보를 어떻게 공유할 것이고, 클러스터에 있는 서버들의 상태를 체크할 필요가 있으며 또한, 분산된 서버들간에 동기화를 위한 락(lock)을 처리하는 것들이 문제로 부딪힌다. 이러한 문제를 해결하는 시스템을 코디네이션 서비스 시스템 (coordination service)라고 하는데, Apache Zookeeper가 대표적이다. 이 코디네이션 서비스는 분산 시스템 내에서 […]
openssl generate self-signed certification
openssl generate self-signed certification ./openssl req -new -x509 -days 365 -nodes \ -out /path/to/pem/file -newkey rsa:2048 \ -keyout /path/to/key/file