AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-120102

HTF's questions

Martin Hope
HTF
Asked: 2018-06-18 07:44:58 +0800 CST

Apache:LocationMatch 或 ProxyMatch 不适用于 RegEx

  • 0

我想将针对确切特定位置的请求重定向到代理服务器,但两种解决方案都不起作用:

<VirtualHost *:80>
  ServerName exmaple.com

<LocationMatch "^/test01$">
  ProxyPreserveHost On
  ProxyPass http://localhost:8000/
  ProxyPassReverse http://localhost:8000/
</LocationMatch>

<ProxyMatch "^/test02$">
  ProxyPreserveHost On
  ProxyPass http://localhost:8000/
  ProxyPassReverse http://localhost:8000/
</ProxyMatch>

</VirtualHost>

测试:

$ curl -I exmaple.com/test01
HTTP/1.1 404 Not Found
Date: Sun, 17 Jun 2018 15:37:10 GMT
Server: Apache
Content-Type: text/html; charset=iso-8859-1

$ curl -I exmaple.com/test02
HTTP/1.1 404 Not Found
Date: Sun, 17 Jun 2018 15:37:13 GMT
Server: Apache
Content-Type: text/html; charset=iso-8859-1

当我删除 RegEx 部分时,它可以工作,但我希望 Apache 显示 404,而不是 Django 开发服务器:

<LocationMatch "/test01">
  ProxyPreserveHost On
  ProxyPass http://localhost:8000/
  ProxyPassReverse http://localhost:8000/
</LocationMatch>

$ curl -I exmaple.com/test01
HTTP/1.1 200 OK
Date: Sun, 17 Jun 2018 15:42:26 GMT
Server: WSGIServer/0.2 CPython/3.6.5
Content-Type: text/html; charset=utf-8
X-Frame-Options: SAMEORIGIN
Content-Length: 12767

$ curl -I exmaple.com/test01/none
HTTP/1.1 404 Not Found
Date: Sun, 17 Jun 2018 15:42:33 GMT
Server: WSGIServer/0.2 CPython/3.6.5
Content-Type: text/html; charset=UTF-8
X-Frame-Options: SAMEORIGIN
Content-Length: 2073

更新:2018 年 6 月 18 日星期一 14:40:59 UTC

所以我做了一些进一步的研究,并根据 Apache文档:

在<Location>节内使用时,第一个参数被省略,本地目录从<Location>. 在一个<LocationMatch>部分内也会发生同样的情况;但是,ProxyPass 不会这样解释正则表达式,因此有必要在这种情况下使用 ProxyPassMatch。

所以我尝试ProxyPassMatch了它,但是匹配的正则表达式被传递给代理http://localhost:8000/test01,这不是我想要的。

我可以使用 Nginx 轻松实现这一点:

server {
    listen 80;
    server_name exmaple.com;

    location = /test01/ {
        proxy_pass http://localhost:8000/;
        proxy_set_header Host $host;
    }
}

我如何用 Apache 做类似的事情?

更新:2018 年 6 月 24 日星期日 10:46:12 UTC

<LocationMatch "^/test01$">
  Redirect / http://test.com/
</LocationMatch>

$ curl -I exmaple.com/test01
HTTP/1.1 302 Found
Date: Sun, 24 Jun 2018 10:47:04 GMT
Server: Apache
Location: http://test.com/test01
Content-Type: text/html; charset=iso-8859-1
apache-2.4
  • 1 个回答
  • 3173 Views
Martin Hope
HTF
Asked: 2017-01-19 07:55:16 +0800 CST

KVM 桥接与多个子网的绑定

  • 0

我可以通过213.xxx.xxx.1分配给主机访问主机,但带有(桥接接口打开)的br0:1虚拟机不起作用。213.xxx.xxx.2br0:1

我是否必须为第二个子网创建另一个桥接接口,但bond0已经连接br0?!

基本上,在这种情况下,我如何将第二个子网用于虚拟机?

子网:

213.xxx.xxx.176/28
213.xxx.xxx.0/27 routed via 213.xxx.xx.180

设置:

时间[1-2]

# cat /etc/sysconfig/network-scripts/ifcfg-em[1-2]
DEVICE="em[1-2]"
NAME="bond0-slave[1-2]"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL=no
IPV6INIT=no
PEERDNS=no
MASTER=bond0
SLAVE=yes

债券0

# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE="bond0"
NAME="bond0"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Bond"
USERCTL="no"
IPV6INIT="no"
PEERDNS="no"
BONDING_OPTS="mode=active-backup miimon=100"
BRIDGE=br0

br0

# cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
NAME="br0"
BOOTPROTO="none"
IPADDR="213.xxx.xxx.180"
GATEWAY="213.xxx.xxx.177"
NETMASK="255.255.255.240"
BROADCAST="213.xxx.xxx.191"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Bridge"
USERCTL="no"
IPV6INIT="no"
PEERDNS="no"

br0:1

# cat /etc/sysconfig/network-scripts/ifcfg-br0:1 
DEVICE="br0:1"
NAME="br0:1"
BOOTPROTO="none"
IPADDR="213.xxx.xxx.1"
NETMASK="255.255.255.224"
BROADCAST="213.xxx.xxx.31"
NM_CONTROLLED="yes"
#ONBOOT="yes"
TYPE="Bridge"
USERCTL="no"
IPV6INIT="no"
PEERDNS="no"
ONPARENT="yes"

2017 年 1 月 18 日星期三 16:25:17 GMT 更新:

<interface type='bridge'>
      <mac address='52:54:00:4c:4f:27'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

2017 年 1 月 24 日星期二 11:44:21 GMT 更新:

虚拟机网络设置:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="213.xxx.xxx.2"
PREFIX="27"
GATEWAY="213.xxx.xxx.177" <-- not sure if this should be 213.xxx.xxx.180 instead?!

主机上的 IPTables:

# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:67
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:68

# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
RETURN     all  --  192.168.122.0/24     224.0.0.0/24        
RETURN     all  --  192.168.122.0/24     255.255.255.255     
MASQUERADE  tcp  --  192.168.122.0/24    !192.168.122.0/24     masq ports: 1024-65535
MASQUERADE  udp  --  192.168.122.0/24    !192.168.122.0/24     masq ports: 1024-65535
MASQUERADE  all  --  192.168.122.0/24    !192.168.122.0/24

当我在VM上将默认网关设置为213.xxx.xxx.1(主机上的br0:1的IP)时,它可以工作 - 不知道为什么我不能只使用与主机相同的默认网关(213.xxx.xxx .177)。

我还必须刷新 IPTables,所以我需要找出哪些规则是必要的。

从 VM ping 时,我也会收到重定向,因此不确定此配置是否最佳:

# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 213.xxx.xxx.1: icmp_seq=1 Redirect Host(New nexthop: 213.xxx.xxx.177)
From 213.xxx.xxx.1 icmp_seq=1 Redirect Host(New nexthop: 213.xxx.xxx.177)
64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=7.26 ms
...

2017 年 1 月 24 日星期二 14:49:43 GMT 更新:

我不确定为什么 IPTables 会过滤通过网桥的数据包​​,即使br_netfilter模块没有加载

# lsmod | grep "br_netfilter"; echo $?
1
# test -d /proc/sys/net/bridge; echo $?
1

这条规则也没有帮助:

# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
kvm-virtualization bonding bridge centos7
  • 2 个回答
  • 1751 Views
Martin Hope
HTF
Asked: 2015-07-18 13:35:35 +0800 CST

SaltStack virt 模块和 LVM

  • 0

这只是一个简单的问题,因为我在文档中找不到答案。是否可以将逻辑卷与Salt Virt一起用于磁盘配置文件?

saltstack
  • 1 个回答
  • 107 Views
Martin Hope
HTF
Asked: 2014-12-02 01:55:31 +0800 CST

SSH 终端挂起 (tty_ldisc_hangup)

  • 3

SSH 控制台超时,我无法执行任何命令。

我注意到我可以远程执行命令,但是当我尝试分配 TTY 时它挂起:

作品:

$ ssh root@example.com "uname -a"
Linux example.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

挂起:

$ ssh -t root@example.com "uname -a"
$ ssh root@example.com "dmesg"
tty_ldisc_hangup: waiting (sshd) for pts1 took too long, but we keep waiting...
  • 操作系统:RHEL 6.6
  • 内核:kernel-2.6.32-504.el6.x86_64
ssh
  • 1 个回答
  • 1941 Views
Martin Hope
HTF
Asked: 2014-07-29 10:39:28 +0800 CST

PDNS 日志轮换

  • 0

我想知道旋转 PowerDNS 日志文件的推荐方法是什么。我在 logrotate 中添加了以下条目:

# cat /etc/logrotate.d/pdns 
/var/log/pdns/*.log {
    daily
    rotate 7
    compress
    delaycompress
}

- 但看起来 PowerDNS 不接受来自 logrotate 的信号,它指的是旧的日志文件:

# lsof | grep "pdns.log*"
rsyslogd  17776    root    5w      REG              253,0      88273     785738 /var/log/pdns/pdns.log-20140728

有两种可用的方法:

1.该copytruncate选项,但随后有警告说某些记录数据可能会丢失。

copytruncate
              Truncate the original log file in place after creating a copy,
              instead of moving the old log file and optionally creating a
              new one.

2.postrotate剧本。似乎需要完全重新启动,因为重新加载(pdns_control 循环)并且kill HUP也被忽略 - 使用这种方法 PowerDNS 将在短时间内不可用。

postrotate
        /sbin/service pdns reload > /dev/null 2>/dev/null || true
    endscript

Q1。 有没有更好的方法来避免潜在的日志数据丢失或需要完全重启?

细节:

- 系统:CentOS 6x

- 版本:pdns-3.3.1 - 相关选项

/etc/pdns/pdns.conf
...
log-dns-queries=yes
loglevel=5
logging-facility=6
...

编辑:

这很奇怪,但我也注意到它默认logging-facility为 system log可以正常工作/var/log/messages。

logrotate
  • 1 个回答
  • 1988 Views
Martin Hope
HTF
Asked: 2014-07-27 11:33:51 +0800 CST

Keepalived:多播与单播

  • 2

我计划部署几个keepalived路由器来维护不同数据库集群的浮动 IP。VRRP instance该计划是根据本指南在本地每个集群上部署一个单独的,因此每个集群上只有两个VRRP路由器/实例。

CentOS 6x 存储库中可用的keepalived软件包是 1.2.7,似乎keepalived直到 1.2.8 版本左右单播才成为主要代码库的一部分。

Q1。 我想知道VRRP多个路由器是否可以用多播广告淹没网络并导致一些性能问题?你会推荐在这种情况下使用单播吗?但是,我注意到以下与单播(Ref.)相关的警告:

vrrp:禁用单播用例的 TTL 健全性检查。为了防止任何数据包注入,VRRP 提供对 IP 标头 TTL 的完整性检查。此 TTL 必须等于 255,表示发送方和接收方都连接在同一以太网段上。现在,随着单播扩展,必须禁用此保护,因为 VRRP 广告将主要遍历不同的网段。!!! 警告 !!!在单播用例中使用 VRRP 以防止任何数据包注入时,最佳做法是使用 IPSEC-AH 身份验证方法,否则您将面临潜在的攻击者!

Q2。 为什么网络上不属于vrrp.mcast.net组播组成员的其他服务器仍然收到 VRRP 通告?

# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      all-systems.mcast.net
eth1            1      all-systems.mcast.net
lo              1      ff02::1
eth0            1      ff02::1:ff33:2440
eth0            1      ff02::1
eth1            1      ff02::1:ff90:4d5b
eth1            1      ff02::1

-

# tcpdump -i eth1 -c 2 host vrrp.mcast.net
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
20:30:46.241228 IP 172.16.0.70 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 3, prio 1, authtype simple, intvl 1s, length 20
20:30:47.241372 IP 172.16.0.70 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 3, prio 1, authtype simple, intvl 1s, length 20
2 packets captured
2 packets received by filter
0 packets dropped by kernel

我想另一种方法是只部署一对VRRP路由器并为所有数据库集群维护 VIP。

multicast
  • 1 个回答
  • 5734 Views
Martin Hope
HTF
Asked: 2014-06-27 03:43:44 +0800 CST

BASH:使用 find 将 bz2 转换为 gzip

  • 1

我想将多重bzip2文件转换为gzip格式。我做到了这一点,foor loop但我想这样做find:

BASH for 循环:

for i in $(ls -1 *.bz2); do echo "Converting: $i to ${i%.bz2}.gz"; { bunzip2 -c $i | gzip > ${i%.bz2}.gz; }; done

我尝试了类似的方法,但它不起作用:

find . -name "*.bz2" -type f -exec bunzip2 -c {} | gzip > ${1%.bz2}.gz \;
bash
  • 1 个回答
  • 735 Views
Martin Hope
HTF
Asked: 2014-05-08 06:16:40 +0800 CST

RHEL5 - 绑定不返回 IPv6 记录

  • 1

我有两个 DNS 解析器:

  • RHEL5 - BIND 9.7.0-P2-RedHat-9.7.0-17.P2.el5_9.2
  • RHEL6 - BIND 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4

配置完全相同,两个 DNS 服务器均未配置 IPv6 地址,BIND 不侦听 IPv6 上的客户端查询。

我想知道为什么只有 RHEL6 返回 IPv6 记录,是否有任何与此相关的配置选项:

RHEL5

# dig @RHEL5 example.com NS

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> @RHEL5 example.com NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59564
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 12

;; QUESTION SECTION:
;example.com.           IN  NS

;; ANSWER SECTION:
example.com.        84843   IN  NS  ns01.example.com.
example.com.        84843   IN  NS  ns02.example.com.

;; ADDITIONAL SECTION:
ns01.example.com.   2233    IN  A   192.168.10.10
ns02.example.com.   2233    IN  A   192.168.20.20

;; Query time: 1 msec
;; SERVER: 10.10.1.10#53(10.10.1.10)
;; WHEN: Wed May  7 15:08:33 2014
;; MSG SIZE  rcvd: 464

RHEL6

# dig @RHEL6 example.com NS

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> @RHEL6 example.com NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59564
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 12

;; QUESTION SECTION:
;example.com.           IN  NS

;; ANSWER SECTION:
example.com.        84843   IN  NS  ns01.example.com.
example.com.        84843   IN  NS  ns02.example.com.

;; ADDITIONAL SECTION:
ns01.example.com.   2233    IN  A   192.168.10.10
ns01.example.com.   171236  IN  AAAA    2001:502:f4gg::1
ns02.example.com.   2233    IN  A   192.168.20.20
ns02.example.com.   171236  IN  AAAA    2410:a1:1024::1

;; Query time: 1 msec
;; SERVER: 10.10.2.10#53(10.10.2.10)
;; WHEN: Wed May  7 15:08:53 2014
;; MSG SIZE  rcvd: 464
domain-name-system
  • 1 个回答
  • 585 Views
Martin Hope
HTF
Asked: 2014-04-05 05:32:46 +0800 CST

Nmap:从范围内查找空闲 IP

  • 18

有没有办法扫描网络上的免费 IP?我使用nmap -sP 192.168.1.0/24,但这实际上显示主机已启动。

nmap
  • 4 个回答
  • 29475 Views
Martin Hope
HTF
Asked: 2014-03-29 04:13:22 +0800 CST

查找、chown 和排除目录

  • 2

我想更改所有文件和目录的所有权,但排除一些目录:

find -user test ! -path "./dir1/*" ! -path "./dir2/*" -exec chown -R root:root {} \;

排除目录的所有权仍然改变?

问候

find
  • 3 个回答
  • 7830 Views
Martin Hope
HTF
Asked: 2013-12-28 04:49:44 +0800 CST

SFTP:为 chroot 用户登录到单独的文件

  • 7

我想将 SFTP 命令记录到单独的文件中,但它仅适用于 chroot 用户,root但不适用于 chroot 用户:

# cat /etc/ssh/sshd_config
...
Subsystem       sftp    internal-sftp -l INFO
Match Group user1
   ChrootDirectory /chroot
   ForceCommand internal-sftp -l INFO
   AllowTcpForwarding no
   X11Forwarding no

-

根据手册页,默认设施是 AUTH

# cat /etc/rsyslog.d/sshd.conf
auth.* /var/log/sftp.log

-

tail -F /var/log/secure /var/log/sftp.log

==> /var/log/secure <==
Dec 27 12:35:09 lab sshd[43014]: Accepted publickey for root from 192.168.1.100 port 44706 ssh2
Dec 27 12:35:09 lab sshd[43014]: pam_unix(sshd:session): session opened for user root by (uid=0)
Dec 27 12:35:09 lab sshd[43014]: subsystem request for sftp

==> /var/log/sftp.log <==
Dec 27 12:35:09 lab internal-sftp[43016]: session opened for local user root from [192.168.1.100]
Dec 27 12:35:10 lab internal-sftp[43016]: opendir "/root/"
Dec 27 12:35:10 lab internal-sftp[43016]: closedir "/root/"
Dec 27 12:35:27 lab internal-sftp[43016]: session closed for local user root from [192.168.1.100]

==> /var/log/secure <==
Dec 27 12:35:27 lab sshd[43014]: Received disconnect from 192.168.1.100: 11: disconnected by user
Dec 27 12:35:27 lab sshd[43014]: pam_unix(sshd:session): session closed for user root
Dec 27 12:35:31 lab sshd[43017]: Accepted password for user1 from 192.168.1.100 port 44708 ssh2
Dec 27 12:35:31 lab sshd[43017]: pam_unix(sshd:session): session opened for user user1 by (uid=0)
Dec 27 12:35:31 lab sshd[43019]: subsystem request for sftp
Dec 27 12:35:31 lab sshd[43020]: session opened for local user user1 from [192.168.1.100]
Dec 27 12:35:31 lab sshd[43020]: opendir "/"
Dec 27 12:35:31 lab sshd[43020]: closedir "/"

编辑:2013 年 12 月 30 日星期一 11:40:18 GMT

系统:CentOS 6.5

我添加了以下选项,但事件仍记录到 /var/log/secure 日志文件中:

# id user1
uid=501(user1) gid=501(user1) groups=501(user1)
# mkdir /chroot/dev
# cat /etc/rsyslog.d/sshd.conf
$AddUnixListenSocket /chroot/dev/log
auth.* /chroot/dev/sftp.log
# service rsyslog restart
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
# ll /chroot/dev/
total 0
srw-rw-rw- 1 root   root   0 Dec 30 11:44 log
-rw------- 1 nobody nobody 0 Dec 30 11:39 sftp.log
sftp
  • 1 个回答
  • 20730 Views
Martin Hope
HTF
Asked: 2013-12-18 07:37:06 +0800 CST

清漆:vcl_error 重定向

  • 0

我有几个关于 Varnish 配置的问题。我有这个简单的配置文件:

backend default {
  .host = "127.0.0.1";
  .port = "80";
}

sub vcl_recv {

if (req.http.Host == "192.168.1.100")
  {
    set req.http.Location = "http://example.com" req.url;
    error 750 "Permanently moved - TEST";
  }
}

sub vcl_error {

if (obj.status == 750) {
  set obj.http.Location = req.http.Location;
  set obj.status = 301;
  return(deliver);
 }
}

问题:

(1)我遵循了这个例子:set req.http.Location = "http://example.com" + req.url;- 但是我无法重新加载清漆,除非我删除这个+符号 - 它是必需的,它的目的是什么?

# /etc/init.d/varnish reload
Loading vcl from /etc/varnish/default.vcl
Current running config name is reload_2013-12-17T15:01:43
Using new config name reload_2013-12-17T15:18:31
Message from VCC-compiler:
Expected variable, string or semicolon
(input Line 124 Pos 58)
    set req.http.Location = "http://example.com" + req.url;
---------------------------------------------------------#---------
Running VCC-compiler failed, exit 1VCL compilation failed
Command failed with error code 106
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 vcl.load failed
varnish
  • 1 个回答
  • 1623 Views
Martin Hope
HTF
Asked: 2013-12-10 01:54:30 +0800 CST

ipvsadm - TCP 超时

  • 2

您能否在连接表中告知这个“过期”时间:

# ipvsadm -lnc | head
IPVS connection entries
pro expire state       source             virtual            destination
TCP 07:17  ESTABLISHED CLIENT_IP:54799 VIP:443   REAL_SERVER_IP:443

我正在使用 Red Hat 负载均衡器(带有防火墙标记的 DR,没有持久性连接),根据文档,TCP、TCP FIN 和 UDP 超时的默认值为 0,但看起来这个到期时间是 15 分钟并且有许多活动连接 - 它与--set参数有关吗?

# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
FWM  80 wlc
  -> REAL_SERVER_1:80               Route   1      402        0         
  -> REAL_SERVER_2:80              Route   1      404        1         
  -> REAL_SERVER_3:80              Route   1      406        0         
FWM  443 wlc
  -> REAL_SERVER_1:443              Route   1      2214       0         
  -> REAL_SERVER_2:443             Route   1      2215       3         
  -> REAL_SERVER_3:443             Route   1      2214       1
lvs
  • 1 个回答
  • 7736 Views
Martin Hope
HTF
Asked: 2013-09-14 01:14:24 +0800 CST

VMware:识别源模板

  • 3

有没有办法识别虚拟机的父模板。我有几个从不同模板创建的虚拟机,我需要确认源模板。

我已经尝试过了blkid,dmidecode -s system-uuid但看起来这些 ID 是为新虚拟机重新生成的。

问候

vmware-esxi
  • 2 个回答
  • 4632 Views
Martin Hope
HTF
Asked: 2013-09-06 13:22:58 +0800 CST

符号链接对 IO 的影响

  • 1

我有一个用于 Web 服务器的 NFS 挂载,我已将日志文件移动到本地存储以最小化 NFS 服务器上的 IO 负载,但我为这些日志创建了符号链接(NFS 共享 -> 本地存储)。

这对 IO 负载的影响是否与直接存储在 NFS 共享上一样?

nfs
  • 1 个回答
  • 79 Views
Martin Hope
HTF
Asked: 2013-09-03 23:40:29 +0800 CST

带有 idmap 的 NFSv4

  • 6

NFS服务器上出现以下错误,请您告诉我如何解决这个问题?

细节:

系统:CentOS 6.4 版,NFS:nfs-utils-1.2.3-36

# cat /etc/idmapd.conf

[General]
Domain = domain.com

[Mapping]
Nobody-User = nobody
Nobody-Group = nobody

[Translation]
Method = nsswitch

Sep  3 08:25:28 snode1 rpc.idmapd[1382]: nss_getpwnam: name '0' does not map into domain 'domain.com'
Sep  3 08:25:29 snode1 rpc.idmapd[1382]: nss_getpwnam: name '500' does not map into domain 'domain.com'

编辑:2013 年 9 月 3 日 10:41

请注意,我使用的是 NFSv4,这些错误仅出现在 NFS 服务器上(不是 NFS 客户端)。

服务器:

# cat /etc/sysconfig/nfs

MOUNTD_NFS_V2="no"
MOUNTD_NFS_V3="no"
...
RPCNFSDARGS="-N 2 -N 3"

客户:

# cat /etc/fstab

server:/     /data  nfs4    defaults,hard,intr,timeo=15,_netdev,noatime,nodiratime,nosuid    0 0

编辑:2014 年 6 月 11 日星期三 14:52:50 BST

# getent passwd "0" | cut -d: -f1
root
# getent passwd "500" | cut -d: -f1
user1

-

# grep "^passwd" /etc/nsswitch.conf 
passwd:     files
nfs
  • 3 个回答
  • 48693 Views
Martin Hope
HTF
Asked: 2013-08-15 04:51:34 +0800 CST

NFSv4 无法在不运行 rpcbind 的情况下为 nfsd 设置任何套接字

  • 8

根据Red Hat docs 'rpcbind' 不再需要:

因为协议支持已被纳入 v4 协议,所以 NFSv4 与 portmap、rpc.lockd 和 rpc.statd 守护进程没有交互。NFSv4 侦听众所周知的 TCP 端口 2049,这消除了端口映射交互的需要。挂载和锁定协议已合并到 V4 协议中,从而消除了与 rpc.lockd 和 rpc.statd 交互的需要。服务器上仍然需要 rpc.mountd 守护程序,但不涉及任何无线操作。

但是,当“rpcbind”服务未运行时,我无法启动 NFS 恶魔:

# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
                                                           [FAILED]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
                                                           [FAILED]

我已禁用 NFS v2 和 v3:

# grep -v "^#" /etc/sysconfig/nfs
MOUNTD_NFS_V2="no"
MOUNTD_NFS_V3="no"
RPCNFSDARGS="-N 2 -N 3"

您能否从下面列出的这些服务中确认服务器和客户端上需要/必不可少的服务(基本上我想禁用不需要的服务):

# rpm -ql nfs-utils | grep 'init.d'
/etc/rc.d/init.d/nfs
/etc/rc.d/init.d/nfslock
/etc/rc.d/init.d/rpcgssd
/etc/rc.d/init.d/rpcidmapd
/etc/rc.d/init.d/rpcsvcgssd
redhat
  • 3 个回答
  • 16266 Views
Martin Hope
HTF
Asked: 2013-06-23 05:10:34 +0800 CST

GlusterFS 直接 I/O 模式

  • 6

您能帮我理解 GlusterFS 中的“direct-io-mode”吗?

我在禁用直接 I/O 模式的情况下获得了更好的读取结果——这是否意味着在禁用模式下它正在从缓存中写入/读取——它是系统缓存还是 GlusterFS 缓存?推荐的方法是什么?我正在使用具有分布式复制卷的 4 个节点进行 Web 服务:

Write: dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
echo 3 > /proc/sys/vm/drop_caches
Read: dd if=tempfile of=/dev/null bs=1M count=1024
Read-Read: dd if=tempfile of=/dev/null bs=1M count=1024

Write           Read            Re-Read
67.5 MB/s       94.9 MB/s       94.6 MB/s   direct-io-mode=enabled
65.8 MB/s       230 MB/s        226 MB/s    direct-io-mode=disabled
glusterfs
  • 2 个回答
  • 10533 Views
Martin Hope
HTF
Asked: 2013-05-14 07:25:05 +0800 CST

Apache 重写规则在“.htaccess”文件中不匹配

  • 2

相同的 Apache 重写规则在 VHost 中有效(匹配)但在“.htaccess”文件中无效:

<VirtualHost *:80>
ServerName 192.168.1.100
ServerAlias example.com
DocumentRoot /test

RewriteEngine On
RewriteRule ^/test.html$ /test2.html
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 9

<Directory "/">
AllowOverride All
</Directory>

</VirtualHost>

重写日志:

192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) init rewrite engine with requested uri /test.html
192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (3) applying pattern '^/test.html$' to uri '/test.html'
192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) rewrite '/test.html' -> '/test2.html'
192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) local path result: /test2.html
192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) prefixed with document_root to /test/test2.html
192.168.1.10 - - [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (1) go-ahead with /test/test2.html [OK]

“.htaccess 文件”

# cat /test/.htaccess 
RewriteEngine On
RewriteRule ^/test.html$ /test2.html

重写日志:

192.168.1.10 - - [13/May/2013:16:22:17 +0100] [example.com/sid#7fd76455b7d0][rid#7fd764af0d78/initial] (3) [perdir /test/] strip per-dir prefix: /test/test.html -> test.html
192.168.1.10 - - [13/May/2013:16:22:17 +0100] [example.com/sid#7fd76455b7d0][rid#7fd764af0d78/initial] (3) [perdir /test/] applying pattern '^/test.html$' to uri 'test.html'
192.168.1.10 - - [13/May/2013:16:22:17 +0100] [example.com/sid#7fd76455b7d0][rid#7fd764af0d78/initial] (1) [perdir /test/] pass through /test/test.html
apache-2.2
  • 2 个回答
  • 381 Views
Martin Hope
HTF
Asked: 2013-05-07 01:48:10 +0800 CST

MegaRAID - 在线更改缓存策略

  • 1

我想用WriteThrough和执行一些测试WriteBack。在生产系统上更改这些设置是否安全?RAID 控制器没有 BBU,所以我WriteBack只想在测试期间启用(sysbench):

# ./MegaCli64 -LDInfo -L0 -a0 | grep "Current Cache Policy:"
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU

# ./MegaCli64 -LDSetProp WB -L0 -a0
megaraid
  • 1 个回答
  • 14007 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve