- 使用步骤参考官方文档;
- 先安装及配置Canal Server;
- 安装配置Canal Adapter;
- 在ElasticSearch中配置索引;
- 启动Canal Adapter,向需要同步的表执行增删改操作.
- 同步成功!
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
// log: 使用Lombok的@Slf4j. | |
/** | |
* | |
* 获取zip文件 | |
* | |
*/ | |
@GetMapping("/get-zip") | |
public void getZip( | |
HttpServletResponse response) { |
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
import org.apache.http.HttpHost; | |
import org.apache.http.auth.AuthScope; | |
import org.apache.http.auth.UsernamePasswordCredentials; | |
import org.apache.http.client.CredentialsProvider; | |
import org.apache.http.conn.ssl.NoopHostnameVerifier; | |
import org.apache.http.impl.client.BasicCredentialsProvider; | |
import org.apache.http.nio.conn.ssl.SSLIOSessionStrategy; | |
import org.apache.http.ssl.SSLContextBuilder; | |
import org.elasticsearch.client.RestClient; |
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
''' | |
MySQL DDL转ElasticSearch Mapping(用于在Kibana中创建索引). | |
输出(示例): | |
新增索引: | |
PUT /t_comm_demo | |
{ |
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
import msoffcrypto | |
import os | |
import logging | |
''' | |
使用正确密码,批量解密XLS文件(非暴力破解) | |
特性: | |
1. 指定文件夹目录中所有文件(默认仅包含.xls文件); |
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
import base64 | |
imgdata = base64.b64decode('base64str') | |
filename = 'base64decode.jpeg' | |
with open(filename, 'wb') as f: | |
f.write(imgdata) |
Windows PowerShell:
pip freeze | %{$.split('==')[0]} | %{pip install --upgrade $}
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
#!coding=utf-8 | |
''' | |
批量写文件. | |
内容一致,但是文件名不同. | |
2021-04-12 | |
''' |
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
#!coding=utf-8 | |
''' | |
根据HTML标签内容,生成测试json数据. | |
2021-02-08 | |
''' |
NewerOlder