Skip to content

Commit 07c4830

Browse files
committed
finish documentation
1 parent 616fdac commit 07c4830

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,64 @@ Simple and fast MySQL to Elasticsearch sync tool, written in Python3.
55
This tool helps you to initialize MySQL dump table to Elasticsearch by parsing mysqldump, then incremental sync MySQL table to Elasticsearch by processing MySQL Binlog.
66

77
## Installation
8+
By following these steps.
9+
##### 1. Python
810
This tool is written in Python3.4, so you must install Python3.4 first, by following [this guide](https://docs.python.org/3.4/using/index.html)
11+
##### 2. ibxml2 and libxslt
12+
Also, this tool depends on python lxml package, so that you should install the lxml's dependecies correctly, the libxml2 and libxslt are required.
913

10-
Also, this tool depends on python lxml package, in which you should install it correctly. (Attention, the lxml needs )
11-
See [lxml Installation](http://lxml.de/installation.html)
14+
For example, in CentOS:
1215

16+
```
17+
sudo yum install libxml2 libxml2-devel libxslt libxslt-devel
18+
```
19+
20+
or in Debian/Ubuntu:
21+
22+
```
23+
sudo apt-get install libxml2-dev libxslt-dev python-dev
24+
```
25+
26+
See [lxml Installation](http://lxml.de/installation.html) for more infomation.
27+
##### 3. mysqldump
28+
And then, mysqldump is required.
29+
30+
31+
##### 4. this tool
1332
Then clone this repo and install dependencies
1433

1534
```
1635
git clone https://github.com/zhongbiaodev/py-mysql-elasticsearch-sync.git
1736
1837
cd py-mysql-elasticsearch-sync
1938
20-
pip install -r requirements.txt
39+
pip3 install -r requirements.txt
2140
```
2241

2342
## Configuration
24-
TODO
43+
There is a [sample config](https://github.com/zhongbiaodev/py-mysql-elasticsearch-sync/blob/master/sample.yaml) file in repo, you can start by editing it.
44+
45+
## Running
46+
Simply run command
47+
48+
```
49+
python3 main.py path/to/your/config.yaml
50+
```
51+
and the tool will dump your data as stream to sync, when dump is over, it will start to sync binlog.
52+
53+
the latest synced binlog file and position are recorded in your info file which is configured in your config file. You can restart dump step by remove it, or you can change sync position by edit it.
54+
55+
Or if you but want to load it from your own dumpfile. You should dump your table first as xml format(by adding ```-X```option to your mysqldump command)
56+
57+
then
58+
```python3 main.py path/to/your/config.yaml --fromfile```
59+
to start sync, when xml sync is over, it will also start binlog sync.
2560

26-
## Deployment and Running
27-
TODO
61+
## Deploying
62+
We provide an upstart script to help you deploy this tool, you can edit it for your own condition, besides, you can deploy it in your own way.
2863

2964

3065
## TODO
31-
- [ ] Documentation
3266
- [ ] Packaging
3367
- [ ] MultiIndex Supporting
3468

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def main():
349349
"""
350350
try:
351351
if not log_file and not log_pos:
352-
if len(sys.argv) > 2 and sys.argv[2] == 'fromfile':
352+
if len(sys.argv) > 2 and sys.argv[2] == '--fromfile':
353353
sync_from_file()
354354
else:
355355
sync_from_stream()

0 commit comments

Comments
 (0)