Giter VIP home page Giter VIP logo

node-red-contrib-stackhero-mysql's Introduction

node-red-contrib-stackhero-mysql

Node-RED node to read and write to a MySQL or a MariaDB database.

It uses TLS (SSL) encryption and is compatible with "Caching SHA2 password" authentication method (MySQL >= 8).

Remember: if you like it, please star it! ๐Ÿฅฐ

Official repository: https://github.com/stackhero-io/node-red-contrib-stackhero-mysql

Example of use

Sponsors

node-red-contrib-stackhero-mysql is developed by Stackhero. If you are looking for powerful managed services, like Node-RED, MySQL or MariaDB, you should seriously consider Stackhero ๐Ÿค“

Usage

This node is really simple.

Put your query in the topic variable and, if you have arguments, put them in an object in the payload variable. You will get the result in the payload output variable.

Example:

msg.topic = 'SELECT * FROM `users` WHERE `name` = :name AND `age` > :age;';
msg.payload = { name: 'Adrien', age: 30 };
return msg;

Avoid SQL injections!!

Do not NEVER EVER put variables content in topic directly! Always use the payload variable to pass your arguments.

Troubleshooting

Error "Connections using insecure transport are prohibited while --require_secure_transport=ON"

You have to connect using TLS encryption. Simply check the box in this node configuration.

Error "ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client"

You are probably using another node than node-red-contrib-stackhero-mysql and tryin to connect to a MySQL >= 8 server using "Caching SHA2 password" authentication method.

To resolve that issue, simply use this node node-red-contrib-stackhero-mysql.

node-red-contrib-stackhero-mysql's People

Contributors

bacto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-red-contrib-stackhero-mysql's Issues

Is there a way that the original message can be part of the data base response?

I have a message with a value, for this value I need to lookup something in the database and for further processing I need the original msg object plus the response from the database.
But as I see it the response from the database will replace the complete msg object with the pure response.
Is there a way to "enrich" the original message with the database response?

msg.payload should be an object containing the query arguments.

Since a few days I get an error message with an empty payload, when trying to request data from my database. The flow was working before without issues providing the request via the message topic. I'm running 1.0.5.

This issue was reported before and appeared to be solved with version 1.0.3. (#1)

What do I need to put into the payload when I want to retrieve data from the db?

Reopen - Connections are stacking

I've created a video going through my whole setup and showing what is what, explaining how I've set it up. Since you couldn't reproduce it using mariadb i've set it all up from scratch using only docker containers and switched to MySQL with the same result.
I'm also showing my flows and such so you can analyze if I'm doing something stupid and causing this. but from my math it's stacking every single SQL connection in my subflow for each subflow every time i deplay. i have used the subflow 3 times throughout my main flows, with 7 sql connections inside the subflow (total 21) and it is stacking 21 every sing time i deploy. If you want i'm up for testing and even do teamviewer if you want so you can go into detail with it. If interested catch me at discord.geekgarage.dk

But here is the video of the whole debacle https://youtu.be/-Kmls2mIX80 (ready in HD)

EDIT: After the video i also did a fresh container in docker of nodered, and it's the same issue.
EDIT2: I've tried taking it out of subflow and into the main flow, without any change. Also Updating to 1.0.4 has not change to the issue
EDIT3: Process List https://i.imgur.com/QPdntib.png and https://i.imgur.com/MkvVgb9.png
https://stackoverflow.com/questions/2407732/mysql-proccesslist-filled-with-sleep-entries-leading-to-too-many-connections

So in conclusion, they don't disconnect from what my limited coding knowledge tells me. So i'm back at the node issue

EDIT4: Another thing i noticed in the above process list. I changed 'SET session wait_timeout=20;' and then had a look in the list again. the connections are kept in sleep state but they reset the counter every 20 second.

Originally posted by @geekgarage in #5 (comment)

New connections piles on top of each other

Hi,

I'm new to NodeRED 1.2.7 and MariaDB 10 but not new to MySQL and MSSQL, and when i suddenly got an error stating 'Too many connections' i knew something was wrong.

So i had a look in the status -> monitor through phpmyadmin and I can see new connections every time i do a full deploy and those new conncetions do close, but they leave behind a running process that never stops, every time i do a deploy in NodeRED where the SQL have been edited and nees to be redeployed. I use the same database connection profile for all nodes.

https://i.imgur.com/MNOhd3x.png

All this culminate into getting an error 'too many connections' and i end up having to reboot my whole sql to get it runnung again

This is the exact error i get after deploying quite a few times
mysqli_real_connect(): (HY000/1040): Too many connections

1.0.3 : breaking change

Upgrading to the latest 1.0.3, all my queries return now : "msg.payload should be an object containing the query arguments."
msg.payload is correct and was working fine before update.
I roll back to previous version.

"msg.payload should be an object containing the query arguments."

topic: "INSERT IGNORE INTO enedis VALUES(:id, :instant, :base);"
payload: object
id: "2021-01-23 07:53:24"
instant: "13"
base: "017387265"

MaxListenersExceededWarning

I updated from node.js 10.x to 12.x and they have implemented some new checks. (also now running NodeRED 1.2.9)

I'm now getting this error:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 state listeners added to [MySQLNode]. Use emitter.setMaxListeners() to increase limit

So i googled it a bit and they are referring back to that it is the code running the connection piling up.
More specific seems like something need to change according to this? (not a coder, more like a scripter so i don't fully understand)
mysqljs/mysql#979 (comment)
&
mysqljs/mysql#979 (comment)

mysqljs/mysql#979

Setup has changed from docker to a full VM but everything else is the same except the version numbers for NodeRED and Node.js.

billede
i think this is related #4 (comment)

Node is showing Error:Pool is closed

I'm using this node within the latest node-red version to connect to a Stackhero MariaDB and the node is showing this error message underneath. The connection to the DB appears to work still, and still allows me to query the DB it seems. Any ideas what might be causing this, it's bothering me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.