You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shellbye@localhost:/var/log/logstash$ curl localhost:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open question_index_from_mysql lcZyx7rvQvmVoeFdwjqn7Q 5 1 3 0 15.4kb 15.4kb
The text was updated successfully, but these errors were encountered:
从MySQL导数据到Elasticsearch,分别需要MySQL(安装参考 #9 )、Elasticsearch(安装参考 #5 )和中间件Logstash(安装参考 #7 )。
构造MySQL数据
首先创建demo要用的数据库
切换数据库
mysql> use demo;
创建demo需要的题目表
向表里插入几条数据
OK,到这里数据就构造好了,如下
配置Logstash
Logstash有专门真对MySQL的input插件,官方文档在这里,这里唯一需要注意的是下载
mysql-connector
的jar
包,并在配置文件中使用绝对路径配置其位置。jar
包可以从这里下载。具体的demo.conf
如下:启动数据传输
因为我们这里数据比较少,所以基本上第一行
select
的日志出来时,数据就已经同步完了。这个时候可以看到ES里面对应的索引里有了3条数据
shellbye@localhost:/var/log/logstash$ curl localhost:9200/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open question_index_from_mysql lcZyx7rvQvmVoeFdwjqn7Q 5 1 3 0 15.4kb 15.4kb
The text was updated successfully, but these errors were encountered: