Memcached error: address already in use - memcached

When I run:
memcached -u nobody -l 0.0.0.0:11211,0.0.0.0:11212
it gives me the error:
Failed to listen on TCP port 11211: Address already in use
Any help would be appreciated.

Please try using 127.0.0.1 instead of using 0.0.0.0 as the IP address for accessing memcache

Try
memcached -u nobody -l 0.0.0.0:11211 && memcached -u nobody -l 0.0.0.0:11212

Related

How to use port 5434 on main server for postgresql streaming replication

I am trying to do streaming replication between two postgresql servers. Main server is listening on port 5434 and I have to keep it so. When I run "pg_basebackup -h (main server ip) -D /var/lib/postgresql/13/main/ -U replicator -P -v -R -X stream -C -S slaveslot1" on replica server I get the follwing error:
"pg_basebackup: error: could not connect to server: Connection refused. Is the server running on host (main server ip) and accepting TCP/IP connections on port 5432?"
Almost all similar questions that I found in the web are dealing with some other problems as their main server is already using port 5432.
So, could you please let me know how I can keep port 5434 on main server and still run the above command for replication? Thanks in advance!
I was expecting the command to run normally and ask me for password.
I have changed the port to 5432 and in that case it works, so the command itself doesn't have mistakes in it.
But I don't know what/how I can do it if I am keeping port 5434.
You can either use the -p option of pg_basebackup, or you can set the PGPORT environment variable, or you can use the -d option with a connection string that contains port=5434.

Docker Error - 5432: bind: address already in use

I used to be able to run docker-compose using 5432:5432 port mapping, but am recently getting this error:
Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use
I've gone through all of the older posts relating to this issue but have yet to be able to solve this.
I've been driving myself mad with this error for the past week trying to figure out how to stop whatever process is running with no avail.
I've tried running
lsof -i tcp:5432
which returns no results (as long as my pgadmin/server is not running)
I've also seen other posts mention running
netstat -anp tcp | grep 5432
which does return two lines:
tcp4 0 0 *.5432 *.* LISTEN
tcp6 0 0 *.5432 *.* LISTEN
But I'm not entirely sure what to do with that output?
Run lsof -i tcp:5432 with sudo rights:
sudo lsof -i tcp:5432
A process (very likely PostgreSQL) is listening on port 5432, preventing another to listen on that port. Stop the process, e.g. with systemctl, then you will be able to start your docker PostgreSQL.
There is a possibility that this might be happening due to multiple instances of postgres running on your machine.
In my case, I had previously installed postgres which was always running on the machine because of which docker-based postgres was unable to start due to the above error. Uninstalling previously installed postgres helped to resolve the issue.

Can't change port of composer-rest-server

I want to change the port of the composer-rest-server and I'm using the -p flag as the help says
However the terminal says that I am missing a parameter
Input:
composer-rest-server -p 8919
Output:
Missing parameter. Please run composer-rest-server -h to see usage details
And when I type the -h flag:
-p, --port The port to serve the REST API on [number]
So, how do I run the composer-rest-server on a different port from 3000?
Use full format for running a business network in different port using this:
composer-rest-server -c admin#sample-network -p 8919
or you can add more parameter like authentication, multiple user support etc.
composer-rest-server -c admin#sample-network -p 8919 -a false -m true
Know all parameters meaning by using this command.
composer-rest-server --help
You must specify business network card name (required)
composer-rest-server -c businessNetworkCardName -p portNumber
For help
composer-rest-server -h
use
composer-rest-server -P portNumber
you are using -p which is use for connection profile name and
-P use for port number

Ncrack just do nothing after launching command

I am pentesting my host using ncrack
I use such command ncrack -U login.txt -P pass.txt -iL ipList.txt -p 3389
After launching it shows me that ncrack has started and nothing happens.
What is the problem please help
This question should be on Security Stackexchange. Anyway, try to change 3389 for rdp.
You can try too removing the list using only one ip to test:
ncrack -vv -U login.txt -P pass.txt x.x.x.x:3389 where x.x.x.x is one of the ips of your list. With -vv you will see more verbose output to find out the error.
Are you sure your ips and/or hostnames on ipList.txt are accesible by network on tcp port 3389?
If not, it is a network problem.

How do I see if memcached is already running on my chosen port?

I am having some problems with memcached and one idea I am having is that perhaps it is already running on the port I am trying to run it on, started by some other user on our network. Is there a way to tell what memcached ports are currently in use?
To see if it is running you could also try telnetting into the port:
telnet localhost 11211
If this works you will see the following (telling you that the given port is open):
Connected to localhost.
Escape character is '^]'.
Now if memcached IS running you can see some basic stats by issuing the given command:
stats
If this fails you will know that memcached is not running.
Try
netstat -ap | grep TheChosenPort#
and see if anything is listening on those TCP or UDP ports.
netstat
In Linux, check via netstat, e.g.
$ sudo netstat -nap | grep memcached
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 5067/memcached
ps
Use ps to filter the processes:
$ ps wuax | grep memcache
497 5067 0.0 1.3 384824 53928 ? Ssl Apr11 1:28 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid -l 127.0.0.1
The port can be found next to -p, e.g. -p 11211. If port hasn't been specified, default is 11211.
Bash
You can send stats command to the given port and see if the memcached responds, e.g.
exec 3<>/dev/tcp/localhost/11211; printf "stats\nquit\n" >&3; cat <&3
Telnet
Use telnet to connect to the host and run stats (as above), e.g.
$ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
stats
STAT pid 23669
STAT uptime 433859
Then hit Ctrl-] and Ctrl-D to finish.
Use the following command
ps -U user | grep -v grep | grep memcached
You can check memcached status
service memcached status
You will see a line like this at the bottom:
└─1560 /usr/bin/memcached -vv -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid
The -p 11211 is what port it's running on.
If you're asking this question, it sounds like you're running a really old version. If you did this on a recent version, you'd see this:
% ./memcached
failed to listen on TCP port 11211: Address already in use