Find Memcache port number when started with homebrew as a service - memcached

I installed homebrew and then memcache through it and started it as a service.I am unable to find on which port it is running though.When I do a ps -ef|grep memcached it does not give me any results.But it is definately running because I could see it listening to socket when I do memcached -vv.
Could anybody help? How can I find out the port number on which it is running?

Homebrew does not specify a port; memcached's default port is 11211. You can use lsof -i to see what processes have open sockets on OS X.

Related

Change PostgreSQL CLIENT Ports

I would like to limit PostgreSQL on what ports he allocates for client connections.
What I mean is having the server listening on 5432, when a connection comes in it will allocate a port to that connection, examples currently on my local test server are 61943, 61949, 61951, 61952, 61957, etc.
In a production server what happens is those client ports are around the high 30000s which is a problem since we have some services running on those, sometimes, before our service has a chance to start, a random client connection will steal the port from it.
How would I go about configuring what the client ports should be for PostgreSQL?
PostgreSQL does not have a way to change this, it's up to the Operating System.
If using a unix system you can tell the system not to reserve ports in the range of your application by doing this (x and y being the port numbers):
sysctl -w net.ipv4.ip_local_port_range="x y"
Edit /etc/sysctl.conf with your preferred text editor and add net.ipv4.ip_local_port_range = x y
Then to reload the file do sysctl -p
This will not kill ongoing connections on the old ports, so a reboot is suggested.

MongoDB Server Ubuntu 16.04

I've installed MongoDB on my Ubuntu 16.04 VPS and allowed connections through the firewall. When I run the server using the command (mongod), it starts without a problem and I can then connect to it (using RoboMongo as test application).
However, when I run the service automatically on startup (using systemctl), I cannot connect to it. I verified it was running, and could not run it myself as the address was already in use.
Does anyone have any experience with this, or any tips on how to solve the problem? The server will be running localhost only and I'm going to be using an SSH tunnel for testing purposes, so no authentication is necessary.
Anyone?
When you started mongod did you then provide a configuration file (using the --config or -f parameter)? If not then it defaults to listening on all interfaces.
The default configuration file which is used when starting the daemon with systemctl defaults to only listen on localhost preventing it from being available on the network. This is fine if you intend to connect to the server using a tunnel.

Tomcat port 80 doesn't work

Using Eclipse, I set up Tomcat Server 7 but seems another application is using the port 80? I got this message from the Tomcat Server:
Port 80 required by Tomcat v7.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)
How do I close anything on the port 80 on Mac OS X ?
You could use lsof -p :80 to know which process is running in port 80. Probably it is Apache. kill -9 pid listed.
EX:
sudo kill -9 `lsof -t -i:80`
Port 80 is for http right? Tomcat's default is 8080. If there is something on a mac running on 80 it would be apache. Do you have personal websharing turned on? Would probably be better to use 8080.

Trying to connect to a remote server using Eclipse

I have an Ubuntu server running Tomcat, and I want to connect my Eclipse EE to it so I can work with JSP.
I have no problem connecting to a similar Tomcat service when it's installed on my machine (not a server), but whenever I try to connect to the remote server I don't seem to have the option of choosing a Tomcat service.
Is there some guide you can recommend (I didn't find one), or is there something I did wrong?
The "remote" Tomcat (or more generally the app server) must be configured to permit such connection.
Did you start the remote server with these parameters:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Alternatively you can add the word jpda at the end of the startup.sh (or .bat) script just when calling the catalina.sh script.
Everything is documented on the Apache Tomcat Wiki.
After enabling those options, you have also another task to do: enabling the network connection to the configured port (8000 in the above options). It depends which firewall is installed on the server but usually it is iptables.
Example of iptables command to enable connection to port 8000:
sudo iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
If your server have a GUI installed, one easiest way is to use the "ufw" – short for 'uncomplicated firewall' as explained in this site which is just a graphical way to configure the iptables.
One way to test the connectivity to the server (if the port is open) is to use telnet from your computer like this:
telnet your.distant.host 8000
and if the command opens, the port is accessible, if the telnet command times out, the port is closed.

Netcat anomaly in VMWare/Cygwin/Sockets environment

I'm happily running Ubuntu Linux in a VMWare box hosted on XP.
My Linux application opens up your basic server socket port, to which I connect netcat (nc) as a client to listen in on the traffic I'm putting on that socket for the "real" clients. All's well.
However, when I open up a Cygwin shell on the XP side and run nc from there it appears to be unable to connect to my application's server socket.
To verify connectivity, though, if I run nc as a server (nc -l -p 3694) in the Linux/VMWare environment, nc on Cygwin has no trouble connecting to it and transferring data back and forth (the IP address is not localhost, it's the one assigned by DHCP).
To summarize:
Linux App -- Linux nc : Works
Linux App -- Cygwin nc : Does not work
Linux nc (svr) -- Cygwin nc : Works
Which netcat code are you using? At least one variant has known issues...
Is it possible you have the guest network set to NAT and therefore things can't connect to something listening in the VM?