-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[fix/#107] Elasticsearch logstash 데이터 색인 방식으로 수정 → book Id 이슈 해결
- Loading branch information
Showing
9 changed files
with
115 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM docker.elastic.co/logstash/logstash:8.8.1 | ||
|
||
ENV MYSQL_CONNECTOR_J_VERSION 8.0.23 | ||
ENV MYSQL_CONNECTOR_J_URL https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION.tar.gz | ||
|
||
# 드라이버 다운로드 및 복사 | ||
RUN curl -L -O $MYSQL_CONNECTOR_J_URL | ||
RUN tar -xvf mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION.tar.gz | ||
RUN cp mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION/mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION.jar /usr/share/logstash/mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION.jar | ||
RUN rm -rf mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION.tar.gz mysql-connector-java-$MYSQL_CONNECTOR_J_VERSION | ||
|
||
CMD ["logstash", "-f", "/usr/share/logstash/pipeline/logstash.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
input { | ||
jdbc { | ||
jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-8.0.23.jar" | ||
jdbc_driver_class => "com.mysql.cj.jdbc.Driver" | ||
jdbc_connection_string => "RDS 엔드포인트" | ||
jdbc_user => "유저" | ||
jdbc_password => "비밀번호" | ||
jdbc_paging_enabled => true | ||
tracking_column => "unix_ts_in_secs" | ||
use_column_value => true | ||
tracking_column_type => "numeric" | ||
schedule => "*/5 * * * * *" | ||
statement => "SELECT *, UNIX_TIMESTAMP(created_at) AS unix_ts_in_secs FROM books WHERE (UNIX_TIMESTAMP(created_at) > :sql_last_value AND created_at < NOW()) ORDER BY created_at ASC" | ||
last_run_metadata_path => "/usr/share/logstash/.logstash_jdbc_last_run" | ||
} | ||
} | ||
filter { | ||
mutate { | ||
copy => {"book_id" => "[@metadata][_id]"} | ||
copy => {"cover_image_url" => "coverImageUrl"} | ||
copy => {"created_at" => "createdAt"} | ||
remove_field => ["@version", "unix_ts_in_secs", | ||
"cover_image_url", "book_id", "updated_at", "height", "is_deleted", "width", "thickness"] | ||
} | ||
} | ||
output { | ||
elasticsearch { | ||
hosts => ["http://elasticsearch:9200"] | ||
index => "book" | ||
document_id => "%{[@metadata][_id]}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters