1 | initial version |
Added my answer at https://stackoverflow.com/questions/50102920/unable-to-run-cygnus-with-mysql-agent
Finally I am able to run Cygnus with MySQL agent. I am using Ubuntu. (Linux ubuntucustomfiware 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x8664 x8664 x86_64 GNU/Linux)
I followed below steps.
Used MySQL installed in main Ubuntu instance instead of Docker container. Modified /etc/mysql/mysql.conf.d/mysqld.cnf and changed
from
bind-address = 127.0.0.1
to
bind-address = *
Login into DB and grant all privileges to root user, so that it can connect from any host.
mysql -u root -p
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'MyPassword';
FLUSH PRIVILEGES;
exit;
Restart MySQL server
service mysql restart
Run Cygnus-ngsi
docker run -d --name cygnus -p 8081:8081 -p 5050:5050 -e CYGNUSMYSQLHOST=PublicIPOfMySQLServer -e CYGNUSMYSQLPORT=3306 -e CYGNUSMYSQLUSER=root -e CYGNUSMYSQLPASS=MyPassword -e CYGNUSLOGLEVEL='DEBUG' fiware/cygnus-ngsi
Modified Agent file and keep only mysql-sink. After below changes, stop/start cygnus docker container.
docker exec -it cygnus /bin/bash
vi /opt/apache-flume/conf/agent.conf
cygnus-ngsi.sinks = mysql-sink
cygnus-ngsi.channels = mysql-channel
exit;
docker stop cygnus
docker start cygnus
Now publish MQTT data to modify my entity and it inserted 4 rows (one row for each attribute) into MySQL DB
mosquitto_pub -h PublicIPOfMySQLServer -u UserName -P Password -t /swm-reader-service1/reader-device-id1/attrs -m '{"tn": "9888", "pn": "878787", "ri": "888888", "tdt":"Monday, May 10, 2018 03:16 AM"}'
Thanks for all your support.
Regards,
Krishan