/
615.txt
149 lines (105 loc) · 4.34 KB
/
615.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
[11] [DFN[[RUBYB[[[UNIXドメインソケット]]]@en[UNIX domain socket]]]]は、
多くの [[UNIX]] 系システムで実装されている [[IPC]] 機構の一種です。
[REFS[
- [15] [CITE[]] ([TIME[2000-01-10 18:36:02 +09:00]] 版) <http://pubs.opengroup.org/onlinepubs/009619199/apdxo.htm>
- [14] [CITE[unix(7) - Linux manual page]] ([TIME[2015-09-09 21:15:22 +09:00]] 版) <http://man7.org/linux/man-pages/man7/unix.7.html>
-- [4] [CITE[Man page of UNIX]]
([TIME[2012-07-10 13:44:11 +09:00]] 版)
<http://linuxjm.sourceforge.jp/html/LDP_man-pages/man7/unix.7.html>
]REFS]
* API
[6] [[Socket]]
* 上位層プロトコル
[1] 様々な[[アプリケーションプロトコル]]の下位層として用いられています。
[10] [[HTTP]] での利用については、 [[HTTP接続]]を参照。
* URL
[5] [[URL scheme]] として [DFN[[CODE(URI)@en[[[unix:]]]]]]
が使われることがあります。
[13] [[PHP]]5以上では [[Unix domain socket]] による[[データグラム]] ([[UDP]] 相当)
を表すために [DFN[[CODE(URI)@en[[[udg:]]]]]] を使っています。
* ホストとポート
[20] 実装によっては、[[ホスト]]を [DFN[[CODE[unix/]]]]、[[ポート]]を[[ファイル名]]とすることで、
[[TCP]] ではなく [[UNIX domain socket]] での接続として扱うことがあります。
* 実装
[FIG(quote)[
[FIGCAPTION[
[2] [CITE@en[Docker basics - Docker Documentation]]
([TIME[2015-02-27 00:20:24 +09:00]] 版)
<https://docs.docker.com/articles/basics/>
]FIGCAPTION]
>
> unix://path/to/socket -> Unix socket located at path/to/socket
]FIG]
[FIG(quote)[
[FIGCAPTION[
[3] [CITE@en[Docker basics - Docker Documentation]]
([TIME[2015-02-27 00:20:24 +09:00]] 版)
<https://docs.docker.com/articles/basics/>
]FIGCAPTION]
>
> $ sudo <path to>/docker -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -d &
]FIG]
[FIG(quote)[
[FIGCAPTION[
[7] [CITE@en[Connection String URI Format — MongoDB Manual 2.6.7]]
([TIME[2015-01-24 08:01:19 +09:00]] 版)
<http://docs.mongodb.org/manual/reference/connection-string/>
]FIGCAPTION]
> The following connects to a UNIX domain socket:
> mongodb:///tmp/mongodb-27017.sock
]FIG]
[FIG(quote)[
[FIGCAPTION[
[8] [CITE[Module ngx_http_proxy_module]]
([TIME[2015-02-26 15:57:24 +09:00]] 版)
<http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass>
]FIGCAPTION]
> or as a UNIX-domain socket path specified after the word “unix” and enclosed in colons:
> proxy_pass http://unix:/tmp/backend.socket:/uri/;
]FIG]
[FIG(quote)[
[FIGCAPTION[
[9] [CITE[AnyEvent::Socket - search.cpan.org]]
([TIME[2015-03-21 20:30:43 +09:00]] 版)
<http://search.cpan.org/dist/AnyEvent/lib/AnyEvent/Socket.pm#($service,_$host)_=_AnyEvent::Socket::unpack_sockaddr_$sa>
]FIGCAPTION]
> 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".
]FIG]
[FIG(quote)[
[FIGCAPTION[
[12] [CITE@en[kennethreitz/dj-database-url]]
([TIME[2015-07-09 00:48:26 +09:00]] 版)
<https://github.com/kennethreitz/dj-database-url>
]FIGCAPTION]
> With PostgreSQL, you can also use unix domain socket paths with percent encoding: postgres://%2Fvar%2Flib%2Fpostgresql/dbname.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[16] [CITE[Using Redis — Celery 3.1.18 documentation]]
([TIME[2015-09-10 03:56:21 +09:00]] 版)
<http://celery.readthedocs.org/en/latest/getting-started/brokers/redis.html>
]FIGCAPTION]
> If a unix socket connection should be used, the URL needs to be in the format:
> redis+socket:///path/to/redis.sock
]FIG]
[FIG(quote)[
[FIGCAPTION[
[17] [CITE@en[Infinario/flask-redis-sentinel]]
([TIME[2015-09-18 15:33:39 +09:00]] 版)
<https://github.com/infinario/flask-redis-sentinel>
]FIGCAPTION]
>
> unix://'''[''':password''']'''@/path/to/socket.sock?db=0
]FIG]
[18] [CITE[Issue 376323002: Refactor unix domain socket. - Code Review]]
([TIME[2015-09-22 18:14:15 +09:00]] 版)
<https://codereview.chromium.org/376323002/>
[FIG(quote)[
[FIGCAPTION[
[19] [CITE[cURL - How To Use]]
( ([TIME[2016-05-31 06:05:05 +09:00]]))
<https://curl.haxx.se/docs/manpage.html#--unix-socket>
]FIGCAPTION]
> --unix-socket <path>
> (HTTP) Connect through this Unix domain socket, instead of using the network. (Added in 7.40.0)
]FIG]