# logstash mysql 연동

**URL:** <https://discuss.elastic.co/t/logstash-mysql/219465>\
**Category:** 한국어 질문 및 토론\
**Created:** [February 15, 2020, 7:18am UTC](https://discuss.elastic.co/t/logstash-mysql/219465 "2020-02-15T07:18:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Su\_Bae](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/su_bae/32/62692_2.png) [@Su\_Bae](https://discuss.elastic.co/u/Su_Bae)\
**Post date:** [February 15, 2020, 7:18am UTC](https://discuss.elastic.co/t/logstash-mysql/219465/1 "2020-02-15T07:18:48Z")

</div>

docker-compose로 ELK 세팅 후 logstash와 Mysql 연동 중입니다.  
Mysql에 데이터가 입력되면 연동되어있는 logstash로 일정시간마다 동기화 시키는게 목적입니다.  
연동이 되어야 스케줄러를 적용하기 때문에 연동 과정에서 에러가 생겼습니다.

centOS  
jdk 1.8

**질문 1.**  
[root@1aefff002dd2 logstash]# bin/logstash -f ./pipeline/logstash.conf

이렇게 conf 파일을 실행하면 아래와 같은 에러가 뜹니다.  
logstash가 이미 instance가 실행되어 있어서 start안되는거 같은데, 이게 뭔지 감이 잘 안잡히네요 ㅠㅠ  
여러개 인스턴스가 아니라 단일로 사용할 예정입니다.

Thread.exclusive is deprecated, use Thread::Mutex  
Sending Logstash logs to /usr/share/logstash/logs which is now configured via log4j2.properties  
[2020-02-14T07:42:29,645][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2020-02-14T07:42:29,660][FATAL][logstash.runner] Logstash could not be started because there is already another instance using the configured data directory. If you wish to run multiple instances, you must change the "path.data" setting.  
[2020-02-14T07:42:29,670][ERROR][org.logstash.Logstash] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

**질문 2.**  
/usr/share/logstash/pipeline/logstash.conf 의 내용입니다.

input {  
tcp {  
port =\> 5000  
}  
jdbc {  
jdbc\_driver\_library =\> "/usr/share/logstash/lib/mysql-connector-java-8.0.18.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://_ **.**.__._\*/_**"  
jdbc\_user =\> "root"  
jdbc\_password =\> "**"  
statement =\> "select \* from TABLE"  
schedule =\> "_ \* \* \* \*"  
}  
}

## Add your filters / logstash plugins configuration here

output {  
elasticsearch {  
hosts =\> "elasticsearch:9200"  
index =\> "qwer"  
}  
stdout {  
codec =\> rubydebug  
}  
}

이렇게 작성했는데 수정할 부분이 있으면 답변 부탁드립니다 ㅠㅠ  
며칠째 구글링 하는데도 해결 안되어 여기까지 찾아왔습니다.  
고수님들 부탁드립니다! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 14, 2020, 7:18am UTC](https://discuss.elastic.co/t/logstash-mysql/219465/2 "2020-03-14T07:18:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
