Redis client connecting to a different port - redis

I have launched redis on port 6379.
And I connected a redis-cli client to the same port.
But when I run this command:
client list
It shows me the following redis-cli connected:
id=5 addr=IP-MASKED:46604 laddr=IP-MASKED:6379 fd=8 name= age=124 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=26 qbuf-free=20448 argv-mem=10 multi-mem=0 rbs=1024 rbp=0 obl=0 oll=0 omem=0 tot-mem=22298 events=r cmd=client|list user=default redir=-1 resp=2
What is port 46604 shown in the addr section?
I see 6379 is also list in the laddr section - and that seems to be the port on which Redis is running.

addr is the IP & port of the client, and in your case, it's redis-cli. laddr is the local IP & port, on which Redis server binds to.
What is port 46604 shown in the addr section?
This is the port that redis-cli uses to communicate with Redis server.

Related

install redis: Failed listening on port 6379 (TCP), aborting

[install redis: Failed listening on port 6379 (TCP), aborting.]
I just trying to install Redis. Then this error happened, someone please help me
[1]: https://i.stack.imgur.com/g7thG.png
I think you have a service up on port 6379 and you can't bind your address on this port. You should kill your already service that bind on port 6379 or bind your redis on new port like 6370.
you can check your up service by netstat -nltp or ps aux

Why haproxy shows 2 redis nodes down even when those are the to redis slave nodes connected to redis master node?

redis-a is master and other 2 are slaves connected to master then why haproxy is showing them as down
this is how i have setup in haproxy config.
defaults REDIS
mode tcp
timeout connect 4s
timeout server 30s
timeout client 30s
frontend front_redis
bind *:3679 name redis
default_backend back_redis
backend back_redis
option tcp-check
tcp-check connect
tcp-check send AUTH\ redis123\r\n
tcp-check expect string +OK
tcp-check send PING\r\n
tcp-check expect string +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server redis-a 192.168.0.15:6379 check inter 1s
server redis-b 192.168.0.14:6379 check inter 1s
server redis-c 192.168.0.16:6379 check inter 1s
# Redis Block end
here is the result of the redis cli via haproxy.
3679> info Replication
# Replication
role:master
connected_slaves:2
slave0:ip=192.168.5.16,port=6379,state=online,offset=1358919,lag=1
slave1:ip=192.168.5.14,port=6379,state=online,offset=1358919,lag=1
master_replid:5a096bcddd97e297wdww236ae9e6dd3f8df9f7
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1359061
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:310486
repl_backlog_histlen:1048576
3679 is haproxy port
my redis version is 6.0.9.
the two server 192.168.0.14 and 192.168.0.16 are sentinel slaves will not have role:master which is your haproxy check. so you need to check for slaves separate check .
that should do it.

Redis replication and client-output-buffer-limit

I am having a problem with redis replication that I can not figure out. Master keeps hitting the client-output-buffer-limit.
Master Config:
# redis-cli -p 6380 config get client-output-buffer-limit
1) "client-output-buffer-limit"
2) "normal 0 0 0 slave 536870912 536870912 0 pubsub 33554432 8388608 60"
Master Log:
Client id=3014598 addr={{MASTER}} fd=6 name= age=217 idle=217 flags=S db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=3723 oll=4806 omem=581952061 events=rw cmd=psync scheduled to be closed ASAP for overcoming of output buffer limits.
Master Info:
# redis-cli -p 6380 info
role:master
connected_slaves:1
slave0:ip={{SLAVE_IP}},port=6380,state=wait_bgsave,offset=0,lag=0 // stays on wait_bgsave
Slave Info:
role:slave
master_host:{{MASTER_IP}}
master_port:6380
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:1
Redis version: 3.0.2
Database size: ~21GB
Master is a 30GB Ram EC2 instance
Slave is a 60GB Ram EC2 instance
The slave is connecting, however the master always times-out no matter how high I set the buffers. The master is almost always in the wait_bgsave state.
Can anybody provide any insight into why this might be happening?
It might be a problem when trying to create the RDB dump file for the replication. It might not have enough RAM available to create the file or maybe there is a peoblem with the slave not being able to read the incoming data fast enough so it gets disconnected.
You can check that by issuing a bgsave on redis-cli and see if it is succesful and also check the redis.conf for the client-output-buffer-limit part. And for a workaround you can try the new diskless replication, it might need less RAM to do it (even though I never found any docs saying that).

RabbitMQ cannot establish TCP connection to any configured hosts

I am trying to run AMQP with bunny and event machine. Whenever I try to use a worker, bunny complains about the following: Could not establish TCP connection to any of the configured hosts
I don't see port 5672 anywhere when I run netstat. Further, the output of nmap -p 5672 0.0.0.0 gives the following:
Nmap scan report for 0.0.0.0
Host is up (0.000092s latency).
PORT STATE SERVICE
5672/tcp closed amqp
My configuration file ($HOME/etc/rabbitmq/rabbitmq.config is as follows:
[{mnesia, [{dump_log_write_threshold, 1000}]},
{rabbit, [{tcp_listeners, [5672]},
{cluster_nodes, {['rabbit#jordan-dev'], disc}}
]}].
Could anybody explain to me why rabbitmq can not connect to the tcp port specified in the configuration file?
Is your firewall configured properly?
Try telnet ip port from some machine is see if it's reachable. If it's not reachable then add the firewall rule.
iptables -A INPUT -p tcp --dport 5672 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5672 -j ACCEPT

What ports does RabbitMQ use?

What ports does RabbitMQ Server use or need to have open on the firewall for a cluster of nodes?
My /usr/lib/rabbitmq/bin/rabbitmq-env is set below which I'm assuming are needed (35197).
SERVER_ERL_ARGS="+K true +A30 +P 1048576 \
-kernel inet_default_connect_options [{nodelay,true}] \
-kernel inet_dist_listen_min 35197 \
-kernel inet_dist_listen_max 35197"
I haven't touched the rabbitmq.config to set a custom tcp_listener so it should be listening on the default 5672.
Here are the relevant netstat lines:
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 728/epmd
tcp 0 0 0.0.0.0:35197 0.0.0.0:* LISTEN 5126/beam
tcp6 0 0 :::5672 :::* LISTEN 5126/beam
My questions are:
for other nodes to be able to connect to the cluster, do all 3 ports 4369, 5672 and 35197 need to be open?
Why isn't 5672 running on tcp and not just tcp6?
PORT 4369: Erlang makes use of a Port Mapper Daemon (epmd) for resolution of node names in a cluster. Nodes must be able to reach each other and the port mapper daemon for clustering to work.
PORT 35197
set by inet_dist_listen_min/max Firewalls must permit traffic in this range to pass between clustered nodes
RabbitMQ Management console:
PORT 15672 for RabbitMQ version 3.x
PORT 55672 for RabbitMQ pre 3.x
Make sure that the rabbitmq_management plugin is enabled, otherwise you won't be able to access management console on those ports.
PORT 5672 RabbitMQ main port (AMQP)
PORT 5671 TLS-encrypted AMQP (if enabled)
For a cluster of nodes, they must be open to each other on 35197, 4369 and 5672.
For any servers that want to use the message queue, only 5672 (or possibly 5671) is required.
What ports is RabbitMQ using?
Default: 5672, the manual has the answer. It's defined in the RABBITMQ_NODE_PORT variable.
https://www.rabbitmq.com/configure.html#define-environment-variables
The number might be differently if changed by someone in the rabbitmq configuration file:
vi /etc/rabbitmq/rabbitmq-env.conf
Ask the nmap if it can see it:
sudo nmap -p 1-65535 localhost
Starting Nmap 5.51 ( http://nmap.org ) at 2014-09-19 13:50 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00041s latency).
PORT STATE SERVICE
443/tcp open https
5672/tcp open amqp
15672/tcp open unknown
35102/tcp open unknown
59440/tcp open unknown
Oh look, 5672, and 15672
Ask netstat if it can see it:
netstat -lntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:55672 0.0.0.0:* LISTEN
tcp 0 0 :::5672 :::* LISTEN
Oh look 5672.
lsof to see ports:
eric#dev ~$ sudo lsof -i | grep beam
beam.smp 21216 rabbitmq 17u IPv4 33148214 0t0 TCP *:55672 (LISTEN)
beam.smp 21216 rabbitmq 18u IPv4 33148219 0t0 TCP *:15672 (LISTEN)
use nmap from a different machine, find out if 5672 is open:
sudo nmap -p 5672 10.0.1.71
Starting Nmap 5.51 ( http://nmap.org ) at 2014-09-19 13:19 EDT
Nmap scan report for 10.0.1.71
Host is up (0.00011s latency).
PORT STATE SERVICE
5672/tcp open amqp
MAC Address: 0A:40:0E:8C:75:6C (Unknown)
Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
Try to connect to a port manually with telnet, 5671 is CLOSED:
telnet localhost 5671
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Try to connect to a port manually with telnet, 5672 is OPEN:
telnet localhost 5672
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Check your firewall:
sudo cat /etc/sysconfig/iptables
It should tell you what ports are made open:
-A INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
Reapply your firewall:
sudo service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
To find out what ports rabbitmq uses:
$ epmd -names
Outputs:
epmd: up and running on port 4369 with data:
name rabbit at port 25672
Run these as root:
lsof -i :4369
lsof -i :25672
More about epmd options.
Port Access
Firewalls and other security tools may prevent RabbitMQ from binding to a port. When that happens, RabbitMQ will fail to start. Make sure the following ports can be opened:
4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools
5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
25672: used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.
15672: HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)
61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled)
1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled
15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)
15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)
Reference doc:
https://www.rabbitmq.com/install-windows-manual.html
Check \AppData\Roaming\RabbitMQ\log. If you have a log file there search for started TCP listener on [::].
It should tell you on which port rabbitMq is running. Look for the last entry.
Disclaimer: not the best way to find port, as there might be a chance the port has been changed in the mean time.