实时同步MySQL多张db表到同一个ES索引

一、需求

提示:提前安装好redis并启动redis服务来存放binlog位置点和binlog文件。
全量同步完这2张表后,开始增量同步这2张表数据到ES索引test01_company_index中


最初的MySQL的binglog位置点和binlog文件如下:

root@tidb04 16:42:  [(none)]> show master status\G
*************************** 1. row ***************************
             File: mysql-bin.000026
         Position: 1300
     Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 
1 row in set (0.00 sec)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.


部署环境参考:

 https://blog.51cto.com/wujianwei/3314093

 https://blog.51cto.com/wujianwei/3241985

 

 

二、mysqlmom同步程序同步binlog的配置文件

 

[root@tidb05 ~]# cat /data1/soft/mysqlsmom01/test_mom/binlog_config.py
# coding=utf-8

STREAM = "BINLOG"  # "BINLOG" or "INIT"
SERVER_ID = 172160197 ### 确保每个用于binlog同步的配置文件的SERVER_ID不同
SLAVE_UUID = __name__

# 一次同步 BULK_SIZE 条数据到elasticsearch,不设置该配置项默认为1
#BULK_SIZE = 10000

BINLOG_CONNECTION = {
    'host': '172.16.0.197',
    'port': 3306,
    'user': 'click_rep',
    'passwd': 'jwtest123456'
}
# redis存储上次同步位置等信息
REDIS = {
    "host": "127.0.0.1",
    "port": 10201,
    "db": 0,
    "password": "YHu222tuEq",  # 不需要密码则注释或删掉该行
}

# 配置es节点
#NODES = [{"host": "127.0.0.1", "port": 9200}]
NODES = [{"host": "172.16.0.247", "port": 9999}]
TASKS = [
##同步test_db.test01表到ES索引:test01_company_index
    {
        "stream": {
            "database": "test_db",
            "table": "test01"
        },
        "jobs": [
           # 同步插入、更新es数据
            {
                "actions": ["insert", "update"],
                "pipeline": [
                    {"only_fields": {"fields": ["id", "username"]}}, ##只同步 id,name和age字段数据到es;注释掉该行则同步全部字段的值到es
                    {"set_id": {"field": "id"}}
                ],
                "dest": {
                    "es": {
                        "action": "upsert",
                        "index": "test01_company_index",
                        "type": "test01",
                        "nodes": NODES
                    }
                }
            },
           #delete 同步删除es数据
            {
               "actions": ["delete"],
               "pipeline": [
                   {"only_fields": {"fields": ["id", "username"]}}, ##只同步 id,name和age字段数据到es;注释掉该行则同步全部字段的值到es
                   {"set_id": {"field": "id"}}
               ],
               "dest": {
                   "es": {
                       "action": "delete",
                       "index": "test01_company_index",
                       "type": "test01",
                       "nodes": NODES
                   }
               }
            }

        ]
    },
##同步test_db.company_staff表到ES索引:test01_company_index
    {
       "stream": {
            "database": "test_db",
            "table": "company_staff"
        },
        "jobs": [
           # 同步插入、更新es数据
            {
                "actions": ["insert", "update"],
                "pipeline": [
                    {"only_fields": {"fields": ["id", "company_name", "company_staff", "channel", "url"]}}, ##只同步 id,name和age字段数据到es;注释掉该行则同步全部字段的值到es
                    {"set_id": {"field": "id"}}
                ],
                "dest": {
                    "es": {
                        "action": "upsert",
                        "index": "test01_company_index",
                        "type": "test01",
                        "nodes": NODES
                    }
                }
            },
           #delete 同步删除es数据
            {
               "actions": ["delete"],
               "pipeline": [
                   {"only_fields": {"fields": ["id", "company_name", "company_staff", "channel", "url"]}}, ##只同步 id,name和age字段数据到es;注释掉该行则同步全部字段的值到es
                   {"set_id": {"field": "id"}}
               ],
               "dest": {
                   "es": {
                       "action": "delete",
                       "index": "test01_company_index",
                       "type": "test01",
                       "nodes": NODES
                   }
               }
            }
    
        ]
    }
]


# CUSTOM_ROW_HANDLERS = "./my_handlers.py"
# CUSTOM_ROW_FILTERS = "./my_filters.py"
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.



启动同步程序binlog_config.py:

 mom run -c ./test_mom/binlog_config.py >mysqlmom.log 2>&1 &
  • 1.



查看初始的存放在redis中MySQL pos和binlog文件:

[root@tidb05 ~]# /usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 10201 -a 'YHu222tuEq'
127.0.0.1:10201> get binlog_config_log_pos
"1300"
127.0.0.1:10201> get binlog_config_log_file
"mysql-bin.000026"
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

 

三、准备测试数据和观察存放在redis中的binlog文件和pos位置点的变化

test01表写入测试数据:

root@tidb04 16:45:  [test_db]> insert into test01(username,password,create_time)value('lua','345543','2021-08-03 23:54:01');
Query OK, 1 row affected (0.00 sec)

root@tidb04 16:46:  [test_db]> select * from test01;
+----+----------+------------+---------------------+
| id | username | password   | create_time         |
+----+----------+------------+---------------------+
|  1 | tomcat   | xiaohuahua | 2021-07-03 23:51:17 |
|  2 | php      | xiao       | 2021-07-03 23:53:36 |
|  3 | fix      | xiao       | 2021-07-03 23:53:49 |
|  4 | java     | bai        | 2021-07-03 23:54:01 |
|  5 | lua      | 345543     | 2021-08-03 23:54:01 |
+----+----------+------------+---------------------+
5 rows in set (0.00 sec)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

查看redis的pos和binlog文件的变化:

 

127.0.0.1:10201> get binlog_config_log_pos
"1572"
127.0.0.1:10201> get binlog_config_log_file
"mysql-bin.000026"
  • 1.
  • 2.
  • 3.
  • 4.


company_staff表写入测试数据:

 

root@tidb04 16:52:  [test_db]> insert into company_staff(company_name,company_staff,channel,url,create_time,update_time)value('天眼查','智联','500-1000人','https://www.zhilian.com/company/832','2021-08-08 15:21:57','2021-08-08 15:22:30');
Query OK, 1 row affected (0.00 sec)
  • 1.
  • 2.



查看redis的pos和binlog文件的变化:

127.0.0.1:10201> get binlog_config_log_pos
"2241"
127.0.0.1:10201> get binlog_config_log_file
"mysql-bin.000026"
  • 1.
  • 2.
  • 3.
  • 4.

同步程序日志输出内容如下:

[root@tidb05 mysqlsmom01]# mom run -c ./test_mom/binlog_config.py
1572
2021-08-08 16:46:43,438 root         INFO     {"timestamp": "2021-08-08 16:46:43", "host": "172.16.0.197", "values": {"username": "lua", "password": "345543", "create_time": "2021-08-03 23:54:01", "id": 5}, "action": "insert", "table": "test01", "schema": "test_db"}
2021-08-08 16:46:43,438 root         INFO     {"username": "lua", "_id": 5, "id": 5}
2021-08-08 16:46:43,446 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.007s]
1940
2021-08-08 16:52:42,284 root         INFO     {"timestamp": "2021-08-08 16:52:42", "host": "172.16.0.197", "values": {"update_time": "2021-08-08 15:22:30", "url": "https://www.zhilian.com/company/832", "company_staff": "\u667a\u8054", "create_time": "2021-08-08 15:21:57", "company_name": "\u5929\u773c\u67e5", "id": 8, "channel": "500-1000\u4eba"}, "action": "insert", "table": "company_staff", "schema": "test_db"}
2021-08-08 16:52:42,284 root         INFO     {"url": "https://www.zhilian.com/company/832", "company_staff": "\u667a\u8054", "company_name": "\u5929\u773c\u67e5", "_id": 8, "id": 8, "channel": "500-1000\u4eba"}
2021-08-08 16:52:42,291 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.007s]
2241
2021-08-08 16:54:22,655 root         INFO     {"timestamp": "2021-08-08 16:54:22", "host": "172.16.0.197", "values": {"username": "ruby", "password": "543", "create_time": "2021-08-05 23:54:01", "id": 6}, "action": "insert", "table": "test01", "schema": "test_db"}
2021-08-08 16:54:22,656 root         INFO     {"username": "ruby", "_id": 6, "id": 6}
2021-08-08 16:54:22,661 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.006s]
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.



 

四、删除test01表和 company_staff 表数据

 

验证删除MySQL test_db下的test01表和 company_staff 表数据是否es也跟着删除数据:



删除mysql表数据:

root@tidb04 17:14:  [test_db]> delete from test01 where id <=3;
Query OK, 3 rows affected (0.00 sec)

root@tidb04 17:15:  [test_db]> select * from test01;
+----+----------+----------+---------------------+
| id | username | password | create_time         |
+----+----------+----------+---------------------+
|  4 | java     | bai      | 2021-07-03 23:54:01 |
|  5 | lua      | 345543   | 2021-08-03 23:54:01 |
|  6 | ruby     | 543      | 2021-08-05 23:54:01 |
+----+----------+----------+---------------------+
3 rows in set (0.00 sec)

root@tidb04 17:16:  [test_db]>  delete from company_staff where id <=3;
Query OK, 3 rows affected (0.01 sec)

root@tidb04 17:16:  [test_db]> select * from company_staff;
+----+---------------+---------------+-------------+-----------------------------------------+---------------------+---------------------+
| id | company_name  | company_staff | channel     | url                                     | create_time         | update_time         |
+----+---------------+---------------+-------------+-----------------------------------------+---------------------+---------------------+
|  4 | 润(中国)     | liepin        | 100-499人   | https://www.liepin.com/company/8321725/ | 2021-06-19 17:21:57 | 2021-06-19 17:21:57 |
|  8 | 天眼查        | 智联          | 500-1000人  | https://www.zhilian.com/company/832     | 2021-08-08 15:21:57 | 2021-08-08 15:22:30 |
+----+---------------+---------------+-------------+-----------------------------------------+---------------------+---------------------+
2 rows in set (0.00 sec)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.

查看mysqlmom日志:

2619
2021-08-08 17:15:52,071 root         INFO     {"timestamp": "2021-08-08 17:15:52", "host": "172.16.0.197", "values": {"username": "tomcat", "password": "xiaohuahua", "create_time": "2021-07-03 23:51:17", "id": 1}, "action": "delete", "table": "test01", "schema": "test_db"}
2021-08-08 17:15:52,071 root         INFO     {"username": "tomcat", "_id": 1, "id": 1}
2021-08-08 17:15:52,126 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.054s]
2021-08-08 17:15:52,127 root         INFO     {"timestamp": "2021-08-08 17:15:52", "host": "172.16.0.197", "values": {"username": "php", "password": "xiao", "create_time": "2021-07-03 23:53:36", "id": 2}, "action": "delete", "table": "test01", "schema": "test_db"}
2021-08-08 17:15:52,127 root         INFO     {"username": "php", "_id": 2, "id": 2}
2021-08-08 17:15:52,132 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.005s]
2021-08-08 17:15:52,133 root         INFO     {"timestamp": "2021-08-08 17:15:52", "host": "172.16.0.197", "values": {"username": "fix", "password": "xiao", "create_time": "2021-07-03 23:53:49", "id": 3}, "action": "delete", "table": "test01", "schema": "test_db"}
2021-08-08 17:15:52,133 root         INFO     {"username": "fix", "_id": 3, "id": 3}
2021-08-08 17:15:52,137 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.004s]
3358
2021-08-08 17:16:43,191 root         INFO     {"timestamp": "2021-08-08 17:16:43", "host": "172.16.0.197", "values": {"update_time": "2021-06-19 17:21:57", "url": "https://www.liepin.com/company/8321725/", "company_staff": "liepin", "create_time": "2021-06-19 17:21:57", "company_name": "\u6c38\u5174\u4e1c\u6da6\uff08\u4e2d\u56fd\uff09\u670d\u9970\u6709\u9650\u516c\u53f8\u5317\u4eac\u6d77\u6dc0\u7b2c\u56db\u513f\u7ae5\u670d\u9970\u5e97", "id": 1, "channel": "100-499\u4eba "}, "action": "delete", "table": "company_staff", "schema": "test_db"}
2021-08-08 17:16:43,191 root         INFO     {"url": "https://www.liepin.com/company/8321725/", "company_staff": "liepin", "company_name": "\u6c38\u5174\u4e1c\u6da6\uff08\u4e2d\u56fd\uff09\u670d\u9970\u6709\u9650\u516c\u53f8\u5317\u4eac\u6d77\u6dc0\u7b2c\u56db\u513f\u7ae5\u670d\u9970\u5e97", "_id": 1, "id": 1, "channel": "100-499\u4eba "}
2021-08-08 17:16:43,198 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.006s]
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

 

在同步的删除的过程中发现个问题:

给表test01表写入6条数据:
root@tidb04 17:38:  [test_db]> select * from test01;
+----+----------+----------+---------------------+
| id | username | password | create_time         |
+----+----------+----------+---------------------+
|  1 | lua      | 345543   | 2021-08-08 17:26:42 |
|  2 | php      | 123456   | 2021-08-08 17:27:03 |
|  3 | java     | 55555    | 2021-08-08 17:27:14 |
|  4 | go       | 44444    | 2021-08-08 17:31:27 |
|  5 | ruby     | 55555    | 2021-08-08 17:31:43 |
|  6 | python   | 6666     | 2021-08-08 17:33:58 |
+----+----------+----------+---------------------+
6 rows in set (0.00 sec)

给表company_staff写入5条数据:
root@tidb04 17:39:  [test_db]> select * from company_staff;
+----+--------------+---------------+-------------+-------------------------------------+---------------------+---------------------+
| id | company_name | company_staff | channel     | url                                 | create_time         | update_time         |
+----+--------------+---------------+-------------+-------------------------------------+---------------------+---------------------+
|  1 | 天眼查       | 智联          | 500-1000人  | https://www.zhilian.com/company/832 | 2021-08-08 15:21:57 | 2021-08-08 15:22:30 |
|  2 | 企查查       | 拉钩          | 500-1000人  | https://www.zhilian.com/company/832 | 2021-08-08 15:21:57 | 2021-08-08 15:22:30 |
|  3 | 爱查查       | boss          | 500-1000人  | https://www.zhilian.com/company/832 | 2021-08-08 15:21:57 | 2021-08-08 15:22:30 |
|  4 | 眼查         | 智联          | 500-1000人  | https://www.zhilian.com/company/832 | 2021-08-08 15:21:57 | 2021-08-08 15:22:30 |
|  5 | 爱查查       | 大王          | 500-1000人  | https://www.zhilian.com/company/832 | 2021-08-08 17:38:02 | 2021-08-08 17:38:02 |
+----+--------------+---------------+-------------+-------------------------------------+---------------------+---------------------+
5 rows in set (0.00 sec)


删除test01表第6条:
root@tidb04 17:39:  [test_db]> delete from test01 where id=6;
Query OK, 1 row affected (0.00 sec)

这个es索引中第6条的id被删除

删除company_staff 表第5条:
root@tidb04 17:41:  [test_db]> delete from company_staff where id=5;

这个es索引中第5条的id被删除
如果此时再次把test01表中的第5条记录删除的话,此时由于刚才这个es索引中id为5的已经被删除了。再次删除会找不到原先的索引id是5的数值,导致同步程序异常退出

root@tidb04 17:43:  [test_db]> delete from test01 where id=5;
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.



具体异常退出日志如下:

2021-08-08 17:43:39,346 root         INFO     {"timestamp": "2021-08-08 17:43:39", "host": "172.16.0.197", "values": {"username": "ruby", "password": "55555", "create_time": "2021-08-08 17:31:43", "id": 5}, "action": "delete", "table": "test01", "schema": "test_db"}
2021-08-08 17:43:39,346 root         INFO     {"username": "ruby", "_id": 5, "id": 5}
2021-08-08 17:43:39,351 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.005s]
Traceback (most recent call last):
  File "/usr/bin/mom", line 10, in <module>
    sys.exit(cli())
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/mysqlsmom/mysqlsmom.py", line 418, in run
    handle_binlog_stream(config_)
  File "/usr/lib/python2.7/site-packages/mysqlsmom/mysqlsmom.py", line 282, in handle_binlog_stream
    to_dest.upload_docs()
  File "/usr/lib/python2.7/site-packages/mysqlsmom/mysqlsmom.py", line 142, in upload_docs
    if not error.values()[0]["found"] == False:
KeyError: 'found'
[root@tidb05 mysqlsmom01]# 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.

由此得出业务应用的MySQL db表是绝对不允许存在delete,或者drop,truncate的,通常业务系统只能是更改数据的状态来标记为删除,而不是直接操作db表进行删除。
所以在配置的同步MySQL数据到es中时,最好不要配置删除的es索引中数据的动作。

 

当然上面的报错如果是少量的话,还是可以解决的,具体解决办法如下:

 

把  {"username": "ruby", "_id": 5, "id": 5} 这行的记录重新写入到 test_db.test01表:

root@tidb04 18:00:  [test_db]> insert into test01(id,username,password,create_time)value(5,'ruby','55555',now());
Query OK, 1 row affected (0.01 sec)

重新执行一遍全量同步:
[root@tidb05 mysqlsmom01]# mom run -c ./test_mom/init_config.py
2021-08-08 18:00:58,890 root         INFO     {"username": "lua", "_id": 1, "id": 1}
2021-08-08 18:00:58,890 root         INFO     {"username": "php", "_id": 2, "id": 2}
2021-08-08 18:00:58,890 root         INFO     {"username": "java", "_id": 3, "id": 3}
2021-08-08 18:00:58,890 root         INFO     {"username": "go", "_id": 4, "id": 4}
2021-08-08 18:00:58,890 root         INFO     {"username": "ruby", "_id": 5, "id": 5}
2021-08-08 18:00:58,890 root         INFO     {"username": "python", "_id": 7, "id": 7}
2021-08-08 18:00:58,890 root         INFO     {"username": "python", "_id": 8, "id": 8}
2021-08-08 18:00:58,891 root         INFO     {"username": "python", "_id": 9, "id": 9}
2021-08-08 18:00:58,891 root         INFO     {"username": "python", "_id": 10, "id": 10}
2021-08-08 18:00:58,900 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.008s]
2021-08-08 18:00:58,902 root         INFO     {"url": "https://www.zhilian.com/company/832", "company_staff": "\u667a\u8054", "company_name": "\u5929\u773c\u67e5", "_id": 1, "id": 1, "channel": "500-1000\u4eba"}
2021-08-08 18:00:58,902 root         INFO     {"url": "https://www.zhilian.com/company/832", "company_staff": "\u62c9\u94a9", "company_name": "\u4f01\u67e5\u67e5", "_id": 2, "id": 2, "channel": "500-1000\u4eba"}
2021-08-08 18:00:58,903 root         INFO     {"url": "https://www.zhilian.com/company/832", "company_staff": "boss", "company_name": "\u7231\u67e5\u67e5", "_id": 3, "id": 3, "channel": "500-1000\u4eba"}
2021-08-08 18:00:58,903 root         INFO     {"url": "https://www.zhilian.com/company/832", "company_staff": "\u667a\u8054", "company_name": "\u773c\u67e5", "_id": 4, "id": 4, "channel": "500-1000\u4eba"}
2021-08-08 18:00:58,904 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.001s]


然后再重新执行增量同步程序,同步正常:
[root@tidb05 mysqlsmom01]# mom run -c ./test_mom/binlog_config.py >mysqlmom.log 2>&1 &
9608
2021-08-08 18:03:34,414 root         INFO     {"timestamp": "2021-08-08 17:43:39", "host": "172.16.0.197", "values": {"username": "ruby", "password": "55555", "create_time": "2021-08-08 17:31:43", "id": 5}, "action": "delete", "table": "test01", "schema": "test_db"}
2021-08-08 18:03:34,414 root         INFO     {"username": "ruby", "_id": 5, "id": 5}
2021-08-08 18:03:34,422 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.007s]
9919
2021-08-08 18:03:34,423 root         INFO     {"timestamp": "2021-08-08 18:00:30", "host": "172.16.0.197", "values": {"username": "ruby", "password": "55555", "create_time": "2021-08-08 18:00:30", "id": 5}, "action": "insert", "table": "test01", "schema": "test_db"}
2021-08-08 18:03:34,423 root         INFO     {"username": "ruby", "_id": 5, "id": 5}
2021-08-08 18:03:34,427 elasticsearch INFO     POST http://172.16.0.247:9999/_bulk [status:200 request:0.004s]
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.

演示到此结束。欢迎留言交流学习

posted @   勤奋的蓝猫  阅读(12)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
点击右上角即可分享
微信分享提示