Skip to content

Commit 6a52360

Browse files
committedJul 8, 2023
more info
1 parent ff4084e commit 6a52360

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed
 

‎README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# MTConnect Agent-to-SQL Relay
2+
A relay connector for scraping topics from an MQTT broker and storing them in a mySQL db
23

3-
run mysql docker:
4+
## Quick Start
5+
`docker run -it -e MYSQL_ROOT_PASSWORD=password123. -e MYSQL_DATABASE=myDB -p 3306:3306 mysql`
46

5-
`docker run -it -e MYSQL_ROOT_PASSWORD=password123. -e MYSQL_DATABASE=myDB -p 3306:3306 mysql`
7+
This command creates a new mySQL Docker container, sets the root password to "password123.", creates a database named "myDB," and opens port 3306 on the container to port 3306 on the host machine.
8+
9+
`python main.py --broker 192.168.0.105 --device-id 0987654321 --db-host 172.18.0.1`
10+
11+
This command specifies a mqtt broker connection at `192.168.0.105`, sets target device id to `0987654321` and sets database host to `172.18.0.1`. All else are left DEFAULT. This command should connect to the db launched in docker above.
12+
13+
### Alternative: Launch VSCode Debugger
14+
15+
Launch debugger w/ included `./vscode/launch.json`
16+
17+
## reference mySQL config
18+
19+
Currently using `mysql.connector`. One convenient way to test is w/ mysql docker container. Launch it with the following:
20+
21+
`docker run -it -e MYSQL_ROOT_PASSWORD=password123. -e MYSQL_DATABASE=myDB -p 3306:3306 mysql`
22+
23+
This command creates a new Docker container with MySQL, sets the root password to "password123.", creates a database named "myDB," and maps port 3306 on the container to port 3306 on the host machine.
24+
25+
# Run it:
26+
`python main.py --broker <broker_host> --device-id <device_id> --db-host <db_host> --db-port <db_port> --db-user <db_user> --db-password <db_password> --db-name <db_name>
27+
`
28+
29+
## CLI Params
30+
31+
| Argument | Description | Default Value |
32+
|-----------------|-------------------------------------------------|---------------|
33+
| --broker | Broker host address | 127.0.0.1 |
34+
| --device-id | Device ID (required) | None |
35+
| --db-host | Remote SQL database host address | 127.0.0.1 |
36+
| --db-port | Remote SQL database port | 3306 |
37+
| --db-user | Remote SQL database username | root |
38+
| --db-password | Remote SQL database password | password123. |
39+
| --db-name | Remote SQL database name | myDB |

0 commit comments

Comments
 (0)
Please sign in to comment.