I have installed the Postgres on my windows 10 PC and I set the environment variable also after when I run psql command it shows following error:
could not connect to server:
Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5433?
I have checked the port no service is running on 5433 and also tried changing it but getting the same error.I also tried installing Postgres outside Program File (thought maybe it's permission related issue) but still problem persist.I installed Postgres 13
A vagrant box which was created using "vagrant package" cannot be connected to using "vagrant ssh".
Note - I am using libvirt and QEMU, not Virtualbox.
I took a working vagrant instance and created a vagrant box using
vagrant package --output abc.box
vagrant box add abc.box --name abc
I then created an empty directory and generated the Vagrantfile using
vagrant init
I edited the Vagrantfile and set config.vm.box = "abc"
I then tried a "vagrant up", and it hangs on the SSH connection
I ran a "vagrant -ssh-config" which returns settings. I was able to use the IP and key listed there to connect to the instance.
Can anybody tell me what the correct process is for getting this kind of instance to start properly? Is it by design that the insecure access isn't preserved in the packaged box? Should I just be installing my own SSH keys and logging in using "ssh" instead of "vagrant ssh"?
I expected the "vagrant up" to complete, but it never returned the prompt. Attempts to connect to it using "vagrant ssh" from another terminal didn't work.
I turned on debugging and saw the log entries listed below.
DEBUG ssh: == Net-SSH connection debug-level log START ==
DEBUG ssh: D, [2019-09-03T18:00:51.803268 #4837] DEBUG -- net.ssh.transport.session[1ae7be8]: establishing connection to 192.168.121.230:22
D, [2019-09-03T18:00:51.804016 #4837] DEBUG -- net.ssh.transport.session[1ae7be8]: connection established
I, [2019-09-03T18:00:51.804202 #4837] INFO -- net.ssh.transport.server_version[1ae6e64]: negotiating protocol version
D, [2019-09-03T18:00:51.804260 #4837] DEBUG -- net.ssh.transport.server_version[1ae6e64]: local is `SSH-2.0-Ruby/Net::SSH_4.2.0 x86_64-linux'
D, [2019-09-03T18:00:51.814838 #4837] DEBUG -- net.ssh.transport.server_version[1ae6e64]: remote is `SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3'
I, [2019-09-03T18:00:51.815157 #4837] INFO -- net.ssh.transport.algorithms[1adcbe4]: sending KEXINIT
D, [2019-09-03T18:00:51.815403 #4837] DEBUG -- socket[1ae792c]: queueing packet nr 0 type 20 len 1156
D, [2019-09-03T18:00:51.815504 #4837] DEBUG -- socket[1ae792c]: sent 1160 bytes
DEBUG ssh: == Net-SSH connection debug-level log END ==
INFO retryable: Retryable exception raised: #<Errno::ECONNRESET: Connection reset by peer - recvfrom(2)>
INFO ssh: Attempting to connect to SSH...
INFO ssh: - Host: 192.168.XXX.XXX
INFO ssh: - Port: 22
INFO ssh: - Username: vagrant
INFO ssh: - Password? false
INFO ssh: - Key Path: ["/home/XXXXX/.vagrant.d/insecure_private_key"]
DEBUG ssh: - connect_opts: {:auth_methods=>["none", "hostbased", "publickey"], :config=>false, :forward_agent=>false, :send_env=>false, :keys_only=>true, :verify_host_key=>false, :password=>nil, :port=>22, :timeout=>15, :user_known_hosts_file=>[], :verbose=>:debug, :encryption=>["aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "rijndael-cbc#lysator.liu.se", "idea-cbc", "arcfour128", "arcfour256", "arcfour", "aes128-ctr", "aes192-ctr", "aes256-ctr", "cast128-ctr", "blowfish-ctr", "3des-ctr", "none"], :logger=>#<Logger:0x00000000034d08c0 #level=0, #progname=nil, #default_formatter=#<Logger::Formatter:0x00000000034d0848 #datetime_format=nil>, #formatter=nil, #logdev=#<Logger::LogDevice:0x00000000034d07f8 #shift_period_suffix=nil, #shift_size=nil, #shift_age=nil, #filename=nil, #dev=#<StringIO:0x00000000034d0938>, #mon_owner=nil, #mon_count=0, #mon_mutex=#<Thread::Mutex:0x00000000034d07a8>>>, :keys=>["/home/XXXXXX/.vagrant.d/insecure_private_key"]}```
I am new to OpenShift, and trying to run elasticsearch in a DIY cartridge. The elasticsearch app seems to be working, but I cannot connect to the 3306 port which it needs for node to node communication.
When I run the
$ rhc port-forward -a myapp
Forwarding ports ...
To connect to a service running on OpenShift, use the local address
Service Local OpenShift
------- -------------- ------------------------
java 127.0.0.1:3306 => 127.10.49.101:3306
java 127.0.0.1:9200 => 127.10.49.101:9200
But when I run my indexing groovy/grails app that uses an elasticsearch plugin to index data, it cannot connect to the OpenShift elasticsearch node. It should be using port 3306 to connect to the OpenShift elasticsearch node. The app config has
client.node = 'node'
client.hosts = [ [host:'127.0.0.1', port:3306 ] ]
Note that my indexing app worked fine when elasticsearch was run locally, but it does not connect to elasticsearch running on OpenShift.
I have problem with connecting to the server on mongodb:
mongo
MongoDB shell version: 3.0.1
connecting to: test
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:179
exception: connect failed
Set up the MongoDB environment (MongoDB’s default data directory path is \data\db):
md \data\db
Start MongoDB (Assuming MongoDB is at "C:\mongodb")
C:\mongodb\bin\mongod.exe
Connect to MongoDB
C:\mongodb\bin\mongo.exe
More Details here.
Run the mongod server:
mongod --dbpath /root/hemant/mongodb_data/data/db
Once the server started listening to the port 27017.
Run the mongo.exe
You might get an error like below:
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:179
exception: connect failed
Restart the machine, this works in my case.
I have a situation somewhat similar to "How to create a ssh tunnel in ruby and then connect to mysql server on the remote host."
From my local machine, I want to run a query against a production MySQL database host.
My local machine cannot directly connect to the database host. However, if I SSH to a gateway machine, I can run the MySQL client and connect to the database host.
I'm trying to figure out how to programmatically to run a query from my machine that is forwarded to the gateway machine, which forwards it to the database server, and have results returned. Basically I want to have LOCAL => GATEWAY => DB_HOST forwarding.
I have a hacky solution that runs ssh.exec and MySQL on the command line, shown below, but, I'm trying to find a way that does port forwarding twice.
I tried, but haven't been successful so far.
require 'rubygems'
require 'mysql2'
require 'net/ssh/gateway'
gateway = Net::SSH::Gateway.new(
$gateway_host, $gateway_user,:password => $gateway_pass)
# This works
ssh = gateway.ssh($db_host, $db_login_user)
data = ssh.exec!("mysql -u#{$db_user} -p#{$db_pass} #{$db_name} -e '#{$sql_query}'")
puts "#{data.class} is the class type"
puts data
# Want to do something like this with port forwarding
# client = Mysql2::Client.new(:host => $db_host,
# :username => $db_user,
# :password => $db_pass,
# :database => $db_name,
# :port => port)
# results = client.query($sql_query)
puts "end stuff"
ssh.close
Any suggestions?
Your diagram lays it out fairly well, you would need a tunnel from the Gateway to the Db_Host; and a second tunnel from your local machine to the gateway. The two tunnels would effectively connect your local machine to the db_host by way of the gateway.
Here's a reference specific to tunneling MySQL over SSH