我有nginx/1.12.0并且根据文档它包含stream模块。我已经使用以下命令安装了 nginx。
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
nginx -v
nginx version: nginx/1.12.0
Run Code Online (Sandbox Code Playgroud)
我尝试在以下位置添加流指令nginx.conf:
stream {
upstream sys {
server 172.x.x.x:9516;
server 172.x.x.x:9516;
}
server {
listen 9516 udp;
proxy_pass sys;
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我重新启动nginx时,nginx日志中出现以下错误
unknown directive "stream" in /etc/nginx/nginx.conf:86
nginx -V output
Run Code Online (Sandbox Code Playgroud)
nginx version: nginx/1.12.0
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector --param=ssp -buffer-size=4 -Wformat -Werror=format-security …Run Code Online (Sandbox Code Playgroud) 使用 nginx http 指令,您可以在同一个端口上拥有多个具有不同名称的服务器:
server {
listen 80;
server_name server1.example.com;
location / {
proxy_pass http://server1.example.com;
}
}
server {
listen 80;
server_name server2.example.com;
location / {
proxy_pass http://server2.example.com;
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以像使用 http 一样在同一端口上使用不同名称的 nginx 代理多个 mysql 服务器?它们不是集群或任何东西的一部分。有不同的,不相关的表。
stream {
upstream db1.example.com {
server db1.example.com:3306;
#server_name db1.example.com; "server_name" directive is not allowed here
}
upstream db2.example.com {
server db2.example.com:3306;
}
server {
listen 3306;
proxy_pass db1.example.com;
}
#duplicate "3306" address and port pair
#server { listen 3306; proxy_pass db2.example.com; }
}
Run Code Online (Sandbox Code Playgroud) 我遇到了很多用例,其中从(通常是换行符分隔的)流中获取输入并以类似 top 的方式对其进行总结非常有用(参见 top、iotop 等)。一种即时数据透视表。
例如采用对数式输入:
I heard A from unit 1 and it said "Great!" 56
I heard A from unit 2 and it said "Oh no!" 42
I heard C from unit 1 and it said "Waiting for input." 33
I heard B from unit 3 and it said "Stopped." -1
...
Run Code Online (Sandbox Code Playgroud)
由此,我们可以运行一个带有正则表达式和组指标的工具:
topify [lineout] [regex] [name #1] [group #1] [name #2] [group #2] [All other columns name position]
where:
lineout is the number of lines before removing …Run Code Online (Sandbox Code Playgroud) 我正在教授 IPv6 课程,并希望为他们创建一个实验室,以了解 ipv6 多播在行动中的真正好处。
我为自己创建了一个多播地址
ff15::1(其中 ff 是多播,1 是瞬态,没有 rsvp,5 是站点范围)。然后我给自己一个组ID为1。
尝试启动流时出现“无主机路由”错误。任何想法都非常感谢。
ps:我对流媒体几乎一无所知。
...
main debug: net: connecting to [[FF15::1]]:1234
main warning: [FF15::1] port 1234 : No route to host
access_output_udp error: failed to create raw UDP socket
main warning: no sout access module matching "udp" could be loaded
main debug: TIMER module_need() : 1.171 ms - Total 1.171 ms / 1 intvls (Avg 1.171 ms)
stream_out_standard error: no suitable sout access module for `udp/ts://[FF15::1]'
...
Run Code Online (Sandbox Code Playgroud)
当然,如果它是一个全新的多播,那么在有人收听之前不会有主机的路由吗?
我之前在这里问过一个问题。我的问题是我试图通过管道将密码提供给 scp
echo mypassword | scp tim@xxx.xxx.xxx.xxx:project/* ~/project/
Run Code Online (Sandbox Code Playgroud)
但是它仍然要求我手动输入密码。我应该如何在命令中将 mypassword 指定为 scp?
我仍然不明白其中一个答复。例如,TTY 的输入流是什么?输入流的常用方法有哪些?如何知道命令的 stdin 输入是什么类型的输入流?例如 ssh/scp。