Hot answers tagged

59 votes

Forward local port or socket file to remote socket file

Altough in the time, when the question was asked, it was really impossible, but it is possible nowadays. You can to both: UNIX => TCP and UNIX => UNIX forwarding. For example (LOCAL PORT TO ...
Igor Chubin's user avatar
38 votes

How to automatically restart a service on failure in Linux

Only answering the service restart part. I came across Monit as well, but on CentOS 7 systemd takes care of all that for you. You just need to add these two lines to the .service file (if they're not ...
Nagev's user avatar
  • 600
34 votes

What is the difference between Unix sockets and TCP/IP sockets?

What's the difference between Unix socket and TCP/IP socket? A TCP/IP socket is used for communication across TCP/IP networks. A connected TCP socket is identified by the combination of local IP, ...
Peter Green's user avatar
  • 4,286
19 votes

Create Unix Named Socket from the Command Line

I simply use netcat and stay listening in such a case: nc -lkU aSocket.sock you should use netcat-openbsd. netcat-traditional does not have -U switch which is for Unix Domain socket.
Karimai's user avatar
  • 291
19 votes

Expose a Unix socket to the host system from inside from a Docker container

You can communicate the host machine or even two containers using the same socket. In the general case of two containers, you should start the two dockers from the host machine sharing a volume that ...
J.M. Robles's user avatar
  • 1,080
17 votes

linux : netstat listening queue length

Let's look into source code, as it's the best documentation in the world of open source. net/ipv4/tcp_diag.c: if (sk->sk_state == TCP_LISTEN) { r->idiag_rqueue = sk->sk_ack_backlog; ...
Alexander's user avatar
  • 456
17 votes

Create Unix Named Socket from the Command Line

You can use python: python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('/tmp/test.sock')" Also C, see this answer.
akostadinov's user avatar
  • 1,188
17 votes

How to find other end of unix socket connection?

Actually, ss from iproute2 (replacement for netstat, ifconfig, etc.) can show this information. Here is an example showing an ssh-agent unix domain socket to which a ssh process has connected: $ ...
Zulakis's user avatar
  • 4,233
17 votes

Can't start mysql service

Run mysqld --help and check, if it reports any problems with config Check logs in /var/log/mysql Try runnig it directly and check errors: mkdir /var/run/mysqld/ chown mysql: /var/run/mysqld/ mysqld ...
Selivanov Pavel's user avatar
12 votes

Siege: descriptor table full sock.c:119: Too many open files

To solve this problem for myself, I had to adjust the OS "ulimit" setting: ulimit -a -- Check current setting ulimit -n 10000 -- Edit setting value Source:
bradforbes's user avatar
11 votes

MySQL Daemon Lock issue

Note to future travelers: It depends on your specific configuration but this is very likely an issue with apparmor. If you don't want to disable locking take a look at syslog and see if you're getting ...
anq's user avatar
  • 211
10 votes

Connect to Milter service unix:/var/run/opendkim/opendkim.sock: No such file or directory

You will need to set the socket file in spool dir of postfix, e.g: /var/spool/postfix/var/run/opendkim After changing that, you might see problem about permission, then just change group owner of ...
HVNSweeting's user avatar
9 votes

Forward local port or socket file to remote socket file

No more socat is needed since ssh 6.7. You can forward unix domain sockets directly like: ssh -nNT -L $(pwd)/docker.sock:/var/run/docker.sock user@someremote More info:
CMCDragonkai's user avatar
7 votes

TIME_WAIT consumes file descriptors?

The file descriptor is used by application to read/write from the socket. Thus if the application call close(), the file descriptor is immediately released. On the other hand, if the application call ...
James Gan's user avatar
  • 396
6 votes

Speed up mongodump+mongorestore

Don't know why I didn't think of it: ssh *** ". /etc/profile; mongodump --host= --db=**** --archive --gzip" | mongorestore --host= --drop --archive --gzip Was 1603.96 ...
warvariuc's user avatar
  • 358
5 votes

How to forcibly close a socket in TIME_WAIT?

Yes, there is. You can use ss to immediately destroy all sockets that are in TIME-WAIT state like this: ss state time-wait sport = 49200 -K After that, restarting your listener should succeed instead ...
maxschlepzig's user avatar
5 votes

Unix socket vs TCP/IP host:port

Pros of Unix domain sockets. Access can be managed through the Unix user permission system either by setting the permissions on the socket itself or by the server reading the usename of the ...
Peter Green's user avatar
  • 4,286
5 votes

Sniff UNIX domain socket

I know this is not answering the main question, but I've ended up here, searching for just sniffing communication on a socket. I've decided to post for others like me. Here's how I did it: $> sudo ...
Anton Valqk's user avatar
5 votes

Apache load balancer for mod_proxy_wstunnel?

According Apache official documentation : mod_proxy_balancer requires the service of mod_proxy and it provides load balancing for all ...
user380440's user avatar
4 votes

How to determine number of open sockets? VM Resource Issues

To watch live MySQL opened connections through UNIX socket, run (as root): watch -n1 'netstat -np | grep -i mysqld'
stamster's user avatar
  • 200
4 votes

Need to increase nginx throughput to an upstream unix socket -- linux kernel tuning?

tl;dr Make sure Unicorn backlog is large (use socket, faster than TCP) listen("/var/www/unicorn.sock", backlog: 1024) Optimise NGINX performance settings, for example worker_connections 10000; ...
Epigene's user avatar
  • 141
4 votes

ERROR 2002 MYSQL socket /tmp/mysql.sock

I know this is an older post, but I spent the last hour or so bouncing back and forth between serverfault, StackOverflow, and DataBase administrators trying to figure out how to solve this issue after ...
Adam Bethke's user avatar
4 votes

Linux command to wait for a SSH server to be up

Something simple like this does the job, waiting 5 seconds between attempts and discarding STDERR until ssh <host> 2> /dev/null do sleep 5 done
Gary's user avatar
  • 41
4 votes

Linux command to wait for a SSH server to be up

This is a 'ping_ssh' script I'm using. It handles timeout cases, fast success, and won't prompt for passwords or be fooled by the port being open but not responding as with 'nc' based solutions. This ...
poleguy's user avatar
  • 201
4 votes

ProxyPass a WebSocket connection to a UNIX socket

Ok I got it, once you have mod_proxy and mod_proxy_wstunnel enabled you can do this: ProxyPass /ws/ unix:/path/to/app.sock|ws:// It works well for me since I only expect to establish ...
zzantares's user avatar
  • 156
4 votes

Multiple readers on a Unix Domain Socket?

In theory you could open a process which opens the socket, forks and each of the clients can then read from the socket. But the end result is probably not what you want. Since every read will remove ...
Steffen Ullrich's user avatar
4 votes

Is it safe to pass my ssl key and cert files to

This is code you're running on your own system. If you don't trust it, then don't give it access to secrets. If you do trust it, then go ahead. Short of paying for a full security audit of the code, ...
EEAA's user avatar
  • 110k
4 votes

System network buffers leaking/fully used, on Windows x64 with plenty of free RAM. How to diagnose and resolve?

Ok, I had been having the same problem for a while. I found another answer that helped. Run "netstat -ano" from a Command Prompt. In my case, the response was an almost-endless list of connections ...
Jacques's user avatar
  • 41
4 votes

Bind a tcp socket below 1000 with a non root user using Systemd, java and Ubuntu 16.04

You’re not actually using the systemd-provided socket in your daemon. Instead of creating a new ServerSocket, use System.inheritedChannel() and check if it’s a ServerSocketChannel. If yes, you ...
Lucas Werkmeister's user avatar
4 votes

Nginx keepalive when using a UNIX socket

UNIX sockets are still connections so the nginx keepalive is a cache of these, and it doesn't matter what happens at the lower levels. keepalive here isn't the same as many other tools/services where ...
danblack's user avatar
  • 1,269

Only top scored, non community-wiki answers of a minimum length are eligible