clickhouse-client get error "Timeout exceeded while reading from socket" - clickhouse

I'm newbie to clickhouse, I'm trying to create a clickhouse database on my unbuntu 18.04 remote server, I follow instruction to install click house from DEB package in this link: https://clickhouse.tech/docs/en/getting_started/install/#from-sources
after that when I run command clickhouse-client it shows something like this :
root#busmap-api-test:~# clickhouse-client
ClickHouse client version 20.3.5.21 (official build)
Connecting to localhost:9000 as user default.
Code: 209. DB::NetException: Timeout exceeded while reading from socket (127.0.0.1:9000)
Can someone help me to figure out what is the problem and how I can solve it?
Thanks,

Follow these steps to resolve the issue:
check that clickhouse-server-service started
service clickhouse-server status
check the server logs to find the possible reason
cat /var/log/clickhouse-server/clickhouse-server.err.log
if occured the error 'Address already in use':
{} <Error> Application: Net Exception: Address already in use: [::1]:9000
{} <Error> Application: Net Exception: Address already in use: 127.0.0.1:9000
need to switch CH-server to any other port by editing tcp_port-param in /etc/clickhouse-server/config.xml-file:
..
<tcp_port>9032</tcp_port>
..
restart CH-server service:
service clickhouse-server restart
and connect this way
clickhouse-client --port 9032

I actually had this problem too but I got it working with the default port.
The setting should be this way if you want to connect remotely and be able to use the loopback from localhost.
<listen_host>::1</listen_host>
<listen_host>0.0.0.0</listen_host>
This allows the loopback method to work (i.e clickhouse-client no args) on localhost to connect through the IPV6 route, and the remote connection (i.e clickhouse-client -h <hostname>) through the IPV4 connection.
My original problem was that i only used <listen_host>0.0.0.0</listen_host> in my config which meant theclickhouse-client no args would not work on localhost. And I could not get both to work by adding <listen_host>127.0.0.1</listen_host>

Related

GRPC server on Mac not working when using laptop's actual IP address instead of localhost

I am following the GRPC tutorials here https://grpc.io/docs/languages/python/.
In greeter_client.py over here - https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_client.py, instead of using
with grpc.insecure_channel('localhost:50051') as channel:
(the above code works fine), I use the following -
with grpc.insecure_channel('XX.XX.XX.XX:50051') as channel:
where XX.XX.XX.XX is my laptop's public IP address from https://www.whatsmyip.org/.
I get this error
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:XX.XX.XX.XX:50051: Failed to connect to remote host: Connection refused"
debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:XX.XX.XX.XX:50051: Failed to connect to remote host: Connection refused {created_time:"2022-12-29T23:18:44.033798+00:00", grpc_status:14}"
does anyone know why this happens? I think this might be a MacOS issue. Mine is a MacOS Monterey, and I have the firewalls all disabled, so I am not sure what else I should be doing. Is this expected behaviour?
Turns out, the best way to deal with this is by using ngrok. The steps would be something like -
Download ngrok (can use brew install ngrok)
Set up forwarding using something like ngrok tcp 50051
Once you click 'enter', there will be a field under Forwarding, which you should then use. Remember to remove the tcp://

mysqld_exporter doesn't connect to mariadb

I am running and mysqld_exporter on the same server. Since I have to use ansible to configure the exporter, I used cloud-alchemy ansible role based on the official prometheus mysqld_exporte that you can see here : https://github.com/cloudalchemy/ansible-mysqld_exporter.
I followed both the role and exporter requirements (ansible version, mysql user) and the installation runs well with no error. Yet according to the logs the exporter can not seem to connect to the database. Here is the error that I get :
caller=exporter.go:149 level=error msg="Error pinging mysqld" err="dial tcp 127.0.0.1:3306: connect: connection refused"
Here is my default/main.yaml looks like on the role :
---
mysqld_exporter_binary_local_dir: ""
mysqld_exporter_version: 0.14.0
mysqld_exporter_web_listen_address: "0.0.0.0:9104"
mysqld_exporter_dsn: "testexpo:xxxx#(localhost:3306)/"
mysqld_exporter_my_cnf: ""
mysqld_exporter_collect: []
mysqld_exporter_no_collect: []
The dsn has been changed according to the user configured. And by the way I can access my database with this user with the command line. All of the necessary ports are open and are listening.
I have tried to change the localhost part to 127.0.0.1, id did not work too.
I have no idea what to try anymore, so if you guys have any idea or advice I will gladly take them ! Thanks in advance.

Cassandra: target machine actively refused it

I am trying to run Cassandra (CQL Shell) and I am receiving the following error, I have tried all the google responses to existing questions, nothing has fixed it so far.
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(10061, "Tried connecting to [('127.0.0.1', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
Before installing Apache Cassandra, JDK must be installed.
Can you make sure the IP address is set correctly on your rpc_address setting in your cassandra.yaml file, on your cassandra server.
Also, you need to make sure port 9042 is open and available for incoming traffic (if your IT department is setting up servers, it is possible this port is blocked, unless otherwise specified...)
Hope it helps.
I also faced the same issue , but may be the below 2 way's can help :
Option 1 :
In my case i haven't started the Cassandra Server and was directly trying to connect to Cassandra.
(a) Firstly start the cassandra server via cmd --> \bin>cassandra.bat -f
and then
(b) Try to connect to it's node --> \bin>cqlsh.bat -u cassandra
Option 2:
Try changing the rpc_address in your cassandra.yaml file to eihter 127.0.0.1 instead of localhost
or to 0.0.0.0 instead of localhost
and then again start the server from new CMD.

No command response from neo4j-shell, despite establishing connection

Created new EC2 instance of neo4j via CloudFormation template found here (ubuntu host).
https://github.com/neo4j-contrib/ec2neo
Got the web interface to work fine, and DB is up and running.
Trying to connect with neo4j-shell from my local dev machine, and I am able to establish a connection to the remote EC2 server.
$ neo4j-shell -host ec2-xx-xx-xx-xx.compute-1.amazonaws.com
Welcome to the Neo4j Shell! Enter 'help' for a list of commands
NOTE: Remote Neo4j graph database service 'shell' at port 1337
neo4j-sh (?)$
netstat confirms that a connection has been ESTABLISHED
tcp6 0 0 xx.xx.xx.xx:1337 my.local.ip.add:13785 ESTABLISHED
At this point, I type help, or any neo4j command, and I get no response back from the server. The console just hangs. As soon as I stop the neo4j service on the server, I get the following exception on the client console.
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:229)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at com.sun.proxy.$Proxy1.interpretLine(Unknown Source)
at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:149)
at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:133)
at org.neo4j.shell.impl.AbstractClient.grabPrompt(AbstractClient.java:101)
at org.neo4j.shell.StartClient.grabPromptOrJustExecuteCommand(StartClient.java:383)
at org.neo4j.shell.StartClient.startRemote(StartClient.java:330)
at org.neo4j.shell.StartClient.start(StartClient.java:196)
at org.neo4j.shell.StartClient.main(StartClient.java:135)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
... 11 more
I have made the following change to neo4j-wrapper.conf :
wrapper.java.additional=-Djava.rmi.server.hostname=ec2-xx-xx-xx-xx.compute-1.amazonaws.com
All iptables are "disabled", to eliminate variables. I am able to run neo4j-shell on the server itself, to 127.0.0.1
What am I missing in my network config or neo4j server config?
Try to ssh into the instance and run it there. remote connections have been a pain for a long time because of the underlying Java RMI port handling.
You can also try out cycli which supports http and auth.

Unable to connect to mysql on ec2-instance from outside

Am unable to connect to mysql database on ec2 from my current server ..
using telnet i tried to check if the port is open .. but i get the following error ..
"telnet: Unable to connect to remote host: Connection refused" ..
i checked the security group as well .. and it has MySQLL (port 3306) added ..
The root device for the instance is EBS ..
any clue where i might be going wrong ??
Abhishek
Check the /etc/my.cnf or where your MySQL config is stored. It probably contains something like bind_address=127.0.0.1 and/or skip-networking.

Resources