MySQL Integration Guide
Review the following guide for setting up an integration between Manufacturing Connect Edge and a MySQL database.
In this guide you will deploy a MySQL database container from Manufacturing Connect Edge and then integrate with the database using the DB-MySQL connector. For your specific scenario you may use an external MySQL database to set up the integration.
If using a database not deployed through Manufacturing Connect Edge, you can use the following supported versions:
- MySQL (4.1+)
- MariaDB
- Percona Server
- Google CloudSQL
- Sphinx (2.2.3+)
For external MySQL databases, refer to the following to learn more:
Note: The version used in this use case for MySQL version is 8.0. See the MySQL 8.0 Reference Manual for more information.
To add the MySQL Marketplace Application:
- In Manufacturing Connect Edge, navigate to Applications > Marketplace.
- Click Marketplace List and select Default Marketplace Catalog.
- Click the MySQL application tile.
- From the Installation script version drop-down list, select latest.
- Configure the following parameters.
- Name: Enter MySQL.
- Database: Enter sample.
- User: Enter user.
- Password: Enter the user password.
- MySQL password: Enter the same value as the Password parameter.
- Click Launch.
- Navigate to Applications > Catalog Apps. The MySQL application appears, pulls the image, and then starts the application. The MySQL application shows as running.
- Navigate to Applications > Containers. The MySQL application Container is running.
- Copy the IP address for the MySQL application.
Follow the steps to Add a Connector and select the DB - MySQL provider.
Configure the following parameters.
- Name: Enter a name for the connector.
- Hostname: Paste the IP address you copied in Step 3.
- Port: The MySQL Server port. The default value is 3306.
- Username: Enter user.
- Password (Optional): Enter the user password.
- Database: Enter sample.
- Table: Enter test_table.
- Show Mapping: Select the check box to display mappings. See Work with Tables in SQL Connectors (Create Table and Show Mapping) to learn more. Too add key/value pairs for the custom table, see Configure Key/Value Pairs.
- Create table: If you want to send data to an existing table in the default format, or you want to create a new table in the default format, select this checkbox and unselect Show Mapping. See Work with Tables in SQL Connectors (Create Table and Show Mapping) to learn more.
- Commit timeout: Enter the transaction commit timeout in (ms).
- Max transaction size: Enter the maximum number of messages before a transaction is committed, regardless of timeout parameter.
- Throttling limit: The maximum number of messages per second to be processed. The default value is zero, which means that there is no limit.
- Persistent storage: When enabled, this will cause messages to undergo a store-and-forward procedure. Messages will be stored within Manufacturing Connect Edge when cloud providers are online.
- Queue Mode: Select the queue mode as lifo (last in first out) or fifo (first in first out). Selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first.
After adding the connector, click the toggle in the connector tile to enable it.
If you see a Failed status, you can review the Connector Logs and relevant error messages.
You will now need to import the tags created in Step 2 as topics for the MySQL connector. The topics will be created as outbound topics.
After adding all required topics, navigate to the Integration overview page and ensure the connector is not disabled and still shows a CONNECTED status.
To enable the topics, return to the Topics tab and click the Enable all topics icon.
You can now verify that you can view data through the terminal command window.
Update the credentials, database name, and table name to your own specific configurations.
To make queries in the container terminal:
- In Manufacturing Connect Edge, navigate to Applications > Containers.
- Click the Terminal icon next to the MySQL container. The MySQL shell opens.
- From the MySQL container terminal, enter mysql -u user -p and press ENTER. Enter password: appears.
- Enter your user password, and then press ENTER. Welcome to the MySQL monitor appears.
- Enter show databases; and press ENTER. The database name appears.
- Enter use sample; and press ENTER. Reading table information for completion of table and column names appears in the console.
- Enter show tables; and press ENTER. The table names for sample appear.
Enter select * from test_table; and press ENTER. Data appears from the imported tags for the connector.