Thingsboard: change of database - linux

I have installed thingsboard on Linux. initially it was using Cassandra database, but now i have changed it to postgresql. But the issue is that both the thingsboard and postgresql are not running. The only error in postgresql log file is "Incomplete startup Packet" and thingsboard log file has "all hosts tried query failed(tried: /127.0.0.1:9042)" error.
I have stopped the Cassandra service and also configured the thingsboard.yml file to use postgresql database.
How to fix this issue.

Without knowing more log details, I suggest to fresh install a new ThingsBoard+PostgreSQL instance and migrate the Cassandra db to the new instance using the REST API feature of ThingsBoard, this way you avoid the corruption of PostgreSQL.
The steps are:
Install a new instance of ThingsBoard and PostgresSQL
Retrieve data via REST API from old instance
Send data via MQTT or other supported protocols to new instance
You can find a script which does this automatically in this repo.

I am not sure but In my experience that you should check up as below.
install PostgreSQL on your server.
create database like thingsboard inside postgreSQL.
configure for using PostgreSQL in thingsboard.yml
Run installation script again
https://thingsboard.io/docs/user-guide/install/linux/#memory-update-for-slow-machines-1gb-of-ram

Related

How to connect Meteor Js application with mongoDB

I start work on fresh application of MeteorJs and facing problem with mongoDB connection with application and have research a lot regarding this but not get any proper solution.
I need to connect my MeteorJs Application with MongoDB and research about this issue but didn't get any solution.
If you are using Meteor Cloud then you should stick to the official docs: https://galaxy-guide.meteor.com/mongodb.html#authentication
If you are using Meteor-Up (MUP) then you should check out the Mongo configuration: https://meteor-up.com/docs.html#mongodb
If you want to connect to a MongoDb with a custom deployment or your local development setup then you need to properly configure the MONGO_URL: https://docs.meteor.com/environment-variables.html#MONGO-URL
Don't forget to configure MONGO_OPLOG_URL as well: https://docs.meteor.com/environment-variables.html#MONGO-OPLOG-URL

Connecting to external database using React, Nodejs, Express, and PostgreSQL

I created a course management system using PHP and HTML. I use PostgreSQL to store data. I use my school's server and database where I could put my files on there with WinSCP and can connect to the database with putty via SSH where I can run queries. Everything works fine.
I am trying to do the exact same project using React, Nodejs, Express, and PostgreSQL. All the tutorials I see online show how to connect to a local database. I want to eventually publish this project and for it to communicate with the same database as my PHP project. Is that possible? So far, I was able to build the client-side of the application(react) but have not been able to communicate with the database (server-side). Any tips?

Node JS db-migrate for different database

I'm already using db-migrate package to migrate MySQL database script and it works well, I've even setup the DATABASE_URL variable in the server environment.
Now I've a requirement to store few details in the sqlite in the same service, I checked db-migrate package for this feature apparently nothing mentioned regard to the executing sql scripts in multiple different databases at one go. Is it possible to do in db-migrate? or do I've to write my own service for this?

how to access sqlite database from node-red node?

I am creating a node-red API service that access SQLite database using SQLite node.
How to configure the database with SQLite node?
I have hard-coded db file in SQLite node.
What is the right way to develop a node-red API that access the SQLite database ?
I think I want to make the database filename configurable, so that it is fetched dynamically.
I am new to node-red programming.
If the changes are only at deploy time not runtime then you can use Environment variables as described in the doc here
If you replace the path to the DB in the config node with ${DB_PATH} then Node-RED will replace this with the value of the DB_PATH environment variable at deploy time.
Have you looked at the documentation for creation configuration nodes?
https://nodered.org/docs/creating-nodes/config-nodes

Developing locally using express, mongodb and mongoose

I'm currently making an app using express, mongodb and mongoose, and I'm running it locally on my machine. My problem is that if I'm not connected to the internet the app won't run at all due to the app not being able to connect to mongodb server.
I thought that if I ran the mongodb server locally on my computer along with the app then I wouldn't need an internet connection, or is my understanding wrong?
Any help would be much appreciated.
The answer is: yes.
If you install MongoDB locally then you won't need internet connection to access it.
Make sure that your connection string contains "localhost".
Also, make sure that you don't need anything else on the internet, and that you run npm install while you are connected to the internet, or otherwise your dependencies (like mongoose) won't get installed. After they are installed they can work without the internet connection just fine - if your database is on localhost.
Also, make sure that your local MongoDB server is running. You can run:
mongo test
in the command line to see if you can connect to a local database.
You're in the right path !
Here's the thing, you need to get yourself a copy of MongoDB, you can download and install the suitable version to your system from here.
Now you need to configure MongoDB in your in your path so you can launch it when you is or simply add it a process that will launch when your system starts.
In order to configure please choose the suitable conf to your system :
Windows.
Linux.
macOS.
Then, before running your application, make sure MongoDB is running in the background ad service or daemon and then simply launch your application.

Resources