index page:GETlocalhost:9200/ get all index:GETlocalhost:9200/_all create index:PUTlocalhost:9200/person delete index:DELETElocalhost:9200/person create data:POSTlocalhost:9200/person/_doc/1
body { "first_name":"Babb", "last_name":"Chen", "age":15, "about":"I love programming and good at sql", "interests": ["music", "java"] }
get by id:localhost:9200/person/_doc/1 search:localhost:9200/person/_doc/_search?q=first_name:babb
create table blog ( id int(11) not null auto_increment, title varchar(60) default null, author varchar(60) default null, content mediumtext, create_time datetime default null, update_time datetime default null, primary key (id) ) engine=InnoDB auto_increment=12 default charset=utf8mb4;
insert into blog values(null, 'php', 'babb', 'php是世界上最好的语言', sysdate() - 10, sysdate()-1); insert into blog values(null, 'Hello world', 'babb', 'Hello world is 世界, 你好', sysdate() - 5, sysdate()); insert into blog values(null, 'php', 'babb', 'php is the best language of the world', sysdate() - 5, sysdate());
C:\Program Files\Elastic\logstash-7.4.0\bin>logstash -f …\config\mysql.conf
错误:找不到或无法加载主类 Files\Elastic\logstash-7.4.0\logstash-core\lib\jars\animal-sniffer-annotations-1.14.jar;
原因: Program Files 存在空格,将 logstash-7.4.0 直接移动到 c 盘下
错误: com.mysql.cj.jdbc.Driver not loaded. Are you sure you’ve included the correct jdbc driver in :jdbc_driver_library
移动 mysql-connector-java-8.0.16.jar 到 C:\logstash-7.4.0\logstash-core\lib\jars 目录下,将 jdbc_driver_library 修改位空即 jdbc_driver_library => “”, 另外 mysql 8 需要将 jdbc_driver_class => “com.mysql.jdbc.Driver” 修改为
jdbc_driver_class => “com.mysql.cj.jdbc.Driver”
错误: Unable to connect to database. Tried 1 times {:error_message=>“Java::JavaSql::SQLException: The server time zone value ‘锟叫癸拷锟斤拷 \u05FC 时锟斤拷’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.”}
修改 jdbc_connection_stringg,设置 Timezone 为 UTC jdbc_connection_string => “jdbc:mysql://127.0.0.1:3306/elastic?useTimezone=true&useLegacyDatetimeCode=false&serverTimezone=UTC”