How to connect to a rethink db hosted on centos? - node.js

I have my rethink db hosted in centos and proxied port 8080 to a domain name using nginx.
From my local pc, how do I connect my app to the server?

you need to open 28015 port on your centos server, than you can connect to rethinkdb listening on 28015 port of your centos server via this connection string
r = require('rethinkdb')
r.connect({ host: 'centos.example.org', port: 28015 }, function(err, conn) {...});
where centos.example.org is hostname/ip of your server.
its worth notice that you should either whitelist your IP in firewall (so, only connections from your home IP is allowed), or install authorization and tls certs on rethinkdb server.
this documents can help -
https://rethinkdb.com/docs/install/centos/
https://rethinkdb.com/docs/start-a-server/

Related

How to install SSL certificate on Redis server over port 6379 OR how to call same on http node server

We have developed application in CodeIgniter (port 443) and Node JS (port 8080) and using Redis (port 6379) in node js.
and SSL certificate are installed in port 443 and 8080 but we are trying to connect redis server over https then it is not working but it is working fine over http.
Please guide.

Node server not reachable from outside

I am playing with a small node server application.I have hosted it in AWS Lightsail's ubuntu instance. It is reachable from local browser like http://localhost:4201/
but when I try to access it from remote, it is unreachable.
In aws instance's network config I have opened traffic for all ports
I have cleared all rules from iptables as well. I am able to reach http port 80 and ping successfully. But no luck with node server, what am I missing? Is there a special way to enable traffic to node server?
I debugged it, basically in server.ts
I had bound it to localhost so it won't accept request from outside
app.listen(4201, '127.0.0.1', function () {
console.log('Server Listening on 0.0.0.0:4201');
});
changed it to 0.0.0.0
app.listen(4201, '0.0.0.0', function () {
console.log('Server Listening on 0.0.0.0:4201');
});
And now it is accessible from everywhere.

As I can, configure the firewall of ubuntu server for the server to accept connections of the terminals through PostgreSQL port 5432

Configuration: Server: Ubuntu server 16.04 LTS using webmin
Terminal: Windows 7 Using PgAmin III
I was unable to establish the connection between my terminal and my server through pgAdmin III on port 5432.
On my server I added:
in file postgresql.conf I edited
in #Connection Settings
listen_addresses = '*'
in file pg_hba.conf I added
in #IPv4 local connections
host all all 172.x.x.x/32 md5 //this is IP Terminal (Hidden x)
I checked the port, this is 5432 default and user is postgres
When I try to establish the connection on PgAdmin III:
Host: //My Server IP (Ping console successful)
Port: 5432
username: postgres
password: //My password
Show me the following message:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "Mi SERVER IP Hidden" and accepting TCP/IP connections on port 5432?
If you encounter this message, please check if the server you're trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first.
For PostgreSQL servers starting with version 8.0, this is controlled using the "listen_addresses" parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use '*' to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you'll need to set the "tcpip_socket" parameter to 'true'.
You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error message, it's still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community.

Sequelize connection over ssh

I am not able to connect to a remote mysql server using sequelize but I am able to ssh into the machine and connect to mysql.
How do I make Sequelize connect to mysql server over ssh rather than directly in node?
You set up an SSH tunnel to your server, which listens on (for example) port 33060:
ssh -NL 33060:localhost:3306 yourserver
In another window/terminal, you can use the MySQL client (assuming that it's installed locally) to connect to the remote MySQL server over the SSH tunnel:
mysql --port 33060 --host 127.0.0.1
If that works, it's just a matter of changing the port number in Sequelize:
var sequelize = new Sequelize('database', 'username', 'password', {
host: "127.0.0.1",
port: 33060
});
If it doesn't work, it might be that the remote MySQL server isn't configured to accept connections over TCP. If that's the case, you should configure your MySQL server to get it to accept TCP connections.

Node.js: Hooking repl to a remote node server

Let's say I have a node server running at mysite.com. Is there a way to set up that server so that I can use node's repl api to securely connect to it from my local machine?
Well, if you used this example:
net.createServer(function (socket) {
repl.start("node via TCP socket> ", socket);
}).listen(5001, "localhost");
And firewalled that port 5001, you should be able to securely connect to it using ssh:
ssh user#host nc localhost 5001
In this case, the security relies on your firewall, and ssh.

Resources