AF_UNIX

AF_UNIX

[11] UNIXドメインソケット (UNIX domain socket) は、 多くの UNIX 系システムで実装されている IPC 機構の一種です。

API

[6] Socket

上位層プロトコル

[1] 様々なアプリケーションプロトコルの下位層として用いられています。

[10] HTTP での利用については、 HTTP接続を参照。

[36] RFC 1459 - Internet Relay Chat Protocol, , https://tools.ietf.org/html/rfc1459#section-8.1.1

URL

[35] Addressing HTTP servers over Unix domain sockets · Issue #577 · whatwg/url · GitHub, https://github.com/whatwg/url/issues/577

unix:

[5] URL scheme として unix: が使われることがあります。

[29] PHP 3+ が実装しています。

[2] Docker basics - Docker Documentation ( 版) https://docs.docker.com/articles/basics/

unix://path/to/socket -> Unix socket located at path/to/socket

[3] Docker basics - Docker Documentation ( 版) https://docs.docker.com/articles/basics/

$ sudo <path to>/docker -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -d &

[17] Infinario/flask-redis-sentinel ( 版) https://github.com/infinario/flask-redis-sentinel

unix://[:password]@/path/to/socket.sock?db=0

[30] FFmpeg Protocols Documentation () https://ffmpeg.org/ffmpeg-protocols.html#unix

Unix local socket

The required syntax for a Unix socket URL is:

unix://filepath

udg:

[13] PHP5以上では Unix domain socket によるデータグラム (UDP 相当) を表すために udg: を使っています。

authority

[33] Dockerhttp://%2Fvar%2Frun%2Fdocker.sock/ のような URL を使っています。

ホストとポート

[20] 実装によっては、ホストunix/ポートファイル名とすることで、 TCP ではなく UNIX domain socket での接続として扱うことがあります。

実装

[7] Connection String URI Format — MongoDB Manual 2.6.7 ( 版) http://docs.mongodb.org/manual/reference/connection-string/

The following connects to a UNIX domain socket:

mongodb:///tmp/mongodb-27017.sock

[8] Module ngx_http_proxy_module ( 版) http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

or as a UNIX-domain socket path specified after the word “unix” and enclosed in colons:

proxy_pass http://unix:/tmp/backend.socket:/uri/;

[9] AnyEvent::Socket - search.cpan.org ( 版) http://search.cpan.org/dist/AnyEvent/lib/AnyEvent/Socket.pm#($service,_$host)_=_AnyEvent::Socket::unpack_sockaddr_$sa

If the $text is unix/, then this function returns a special token recognised by the other functions in this module to mean "UNIX domain socket".

[12] kennethreitz/dj-database-url ( 版) https://github.com/kennethreitz/dj-database-url

With PostgreSQL, you can also use unix domain socket paths with percent encoding: postgres://%2Fvar%2Flib%2Fpostgresql/dbname.

[16] Using Redis — Celery 3.1.18 documentation ( 版) http://celery.readthedocs.org/en/latest/getting-started/brokers/redis.html

If a unix socket connection should be used, the URL needs to be in the format:

redis+socket:///path/to/redis.sock

[18] Issue 376323002: Refactor unix domain socket. - Code Review ( 版) https://codereview.chromium.org/376323002/

[19] cURL - How To Use ( ()) https://curl.haxx.se/docs/manpage.html#--unix-socket

--unix-socket <path>

(HTTP) Connect through this Unix domain socket, instead of using the network. (Added in 7.40.0)

[34] curl - How To Use, , https://curl.haxx.se/docs/manpage.html#--abstract-unix-socket

[21] Connection String URI Format — MongoDB Manual 3.2 () https://docs.mongodb.com/manual/reference/connection-string/

The following connects to a UNIX domain socket:

mongodb:///tmp/mongodb-27017.sock

[22] MySQL — SQLAlchemy 0.9 Documentation () http://docs.sqlalchemy.org/en/rel_0_9/dialects/mysql.html

mysql+mysqldb://root@/<dbname>?unix_socket=/cloudsql/<projectid>:<instancename>

[23] java - JDBC MySQL connection using Unix Socket - Stack Overflow () http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket

As another answer pointed out, it's possible (at least in Intellij IDE) to use socket connection for Mysql JDBC Connector/J (I am using version 5.1) without having to provide a socketFactory,

jdbc:mysql://localhost:3306/database_name?socket=/tmp/mysql.sock

[24] java - JDBC MySQL connection using Unix Socket - Stack Overflow () http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket

The JDBC Driver from the MariaDB project supports Unix domain sockets while remaining compatible with the MySQL Connector/J JDBC driver. Example jdbc url for the MariaDB driver is: jdbc:mariadb://localhost:3306/revmgt?localSocket=/var/run/mysqld/mysqld.sock

[25] The DB-URI — TurboGears 1.0 documentation () http://turbogears.org/1.0/docs/DbUri.html

mysql://localhost/database?unix_socket=/var/lib/mysql/socket

[26] The DB-URI — TurboGears 1.0 documentation () http://turbogears.org/1.0/docs/DbUri.html

If your Linux or OS X installation has a standard setup and there’s a live socket at /tmp/.s.PGSQL.5432, your SQLAlchemy PostgreSQL dburi can be this simple:

postgres:///dbname

To specify the socket file for PostgreSQL, put the absolute path after the double slash:

postgres:///var/run/postgresql/test?debug=1

However, there are bugs in the DSN parser for SQLObject, so that it fails to separate the socket path from the database name. A DSN like this works around that issue:

postgres:///dbname?host=/path/to/socket

[27] nova.conf - configuration options - OpenStack Configuration Reference  - kilo () http://docs.openstack.org/kilo/config-reference/content/list-of-compute-config-options.html

connection_url = None (StrOpt) URL for connection to XenServer/Xen Cloud Platform. A special value of unix://local can be used to connect to the local unix socket. Required if compute_driver=xenapi.XenAPIDriver

[28] Linknx / Wiki / Services_section () https://sourceforge.net/p/linknx/wiki/Services_section/

The knxconnection element configures the connection to EIBD. The url parameter can be "local:/path/to/unix/socket" if EIBD uses unix sockets or "ip:ip-address:port" if EIBD uses internet sockets (port is optional; default = 6720)

[31] Compose CLI environment variables | Docker Documentation ( ()) https://docs.docker.com/compose/reference/envvars/

DOCKER_HOST

Sets the URL of the docker daemon. As with the Docker client, defaults to unix:///var/run/docker.sock.

[32] http+docker://localunixsocket