Академический Документы
Профессиональный Документы
Культура Документы
INSTALL
https://www.digitalocean.com/community/tutorials/how-to-connect-your-internet-of-things-
with-node-red-on-ubuntu-16-04
SQL :
Firefox # Firefox
1. Open the Console
Go to the screen where you are experiencing the error. In Firefox, navigate to Tools > Web
Developer > Error Console or press Ctrl + Shift + J.
2. Identify the Error
The error console will open. If you don’t see any errors try reloading the page. The error may be
generated when the page loads.
The console will provide you with the error type, the location of the error and the line number
The image above shows the error to be in jquery.js on line 2.
https://github.com/mysqljs/mysql
Requires node-red-node-mysql and configuration of your MQTT and MySQL server details
[{"id":"a06d74db.919808","type":"mqtt
in","z":"b194ff77.b24e2","name":"","topic":"#","qos":"2","broker":"","x":210,"y"
:460,"wires":[["98201759.e4d558"]]},
{"id":"6825dd23.d4ee44","type":"debug","z":"b194ff77.b24e2","name":"","active":t
rue,"console":"false","complete":"true","x":610,"y":420,"wires":[]},
{"id":"98201759.e4d558","type":"function","z":"b194ff77.b24e2","name":"Create
query in topic","func":"var out = \"INSERT INTO tcl_mqtt_log
(timestamp,topic,data)\"\nout = out + \"VALUES ('\" + new Date().toISOString() +
\"','\" \nout = out + msg.topic + \"','\" + msg.payload + \"');\"\n
\nmsg.topic=out;\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":460,"wires":
[["6825dd23.d4ee44","ddb3e588.199508"]]},
{"id":"be41a506.f7f9f8","type":"comment","z":"b194ff77.b24e2","name":"Log
everything","info":"","x":200,"y":420,"wires":[]},
{"id":"4265dd53.5b18a4","type":"debug","z":"b194ff77.b24e2","name":"","active":t
rue,"console":"false","complete":"false","x":750,"y":460,"wires":[]},
{"id":"ddb3e588.199508","type":"mysql","z":"b194ff77.b24e2","name":"","x":610,"y
":460,"wires":[["4265dd53.5b18a4"]]}]
node-red-contrib-postgres-multi 0.2.0
A Node-RED node to query PostgreSql, with multi-query support
npm install node-red-contrib-postgres-multi
node-red-contrib-postgres-multi
A Node-RED node to query PostgreSQL, with multiple query support.
Based on node-red-contrib-postgres by Kris Daniels.
Ini orinyo
var out = "INSERT INTO `sensor-nodered` ( `waktu`, `topic`, `nilai`))"
out = out + "VALUES ('" + new Date().toISOString() + "','"
out = out + msg.topic + "','" + msg.payload + "');"
msg.topic=out;
return msg;
YANG DI PERBAHARUI
return msg;
BELAJAR NODERED :
http://noderedguide.com/tutorial-sqlite-and-node-red/
http://noderedguide.com/node-red-lecture-6-intermediate-flows-2/
If you want to create your own front end for Node-RED the best place for you to start would be the
ui-builder project https://www.npmjs.com/package/node-red-contrib-uibuilder 207
This is a production level Node.JS mySQL connection pool wrapper powered by mysqljs/mysql.
Summary
This module allows for intelligent management & load balancing of mySQL connection pools. It is
written in JavaScript, does not require compiling, and is MIT licensed. Its designed to be used by
persistent and self-terminating processes.
Using PM2
PM2 is a process manager for Node.js. It makes it easy to run applications on boot and ensure they
are restarted if necessary.
1. Install PM2
sudo npm install -g pm2
The -- argument must appear before any arguments you want to pass to node-red.
pm2 start /usr/bin/node-red -- -v
Note : if you are running on a device like the Raspberry Pi or BeagleBone Black that have a
constrained amount of memory, you must pass an additional argument:
pm2 start /usr/bin/node-red --node-args="--max-old-space-size=128" -- -v
Note : if you want to run as the root user, you must use the `--userDir` option to specify where
Node-RED should store your data.
This will start Node-RED in the background. You can view information about the process and
access the log output using the commands:
pm2 info node-red
pm2 logs node-red
5. Reboot
Finally, reboot and check everything starts as expected.
UNTUK CEK STATUS NODE-RED :
https://app.pm2.io/bucket/5d76e778d4f97908835c60fb/backend/overview/servers
https://nodered.org/docs/faq/starting-node-red-on-boot
pm2 monitor
UNTUK FIREWALL
SUPAYA BISA DI AKSES DARI WEBSITE
UFW StatusPermalink
You can check the status of UFW at any time with the command: sudo ufw status. This will
show a list of all rules, and whether or not UFW is active: