如果在tomcat的maxThreads
中配置了maxConnections
和/或connector port 8080
,我需要了解一下。
示例:
<Connector port="8080" protocol="HTTP/1.1"
maxThreads="600"
maxConnections="3000"
connectionTimeout="20000"
redirectPort="443" />
我用regex
尝试了但很难失败。
$file = Get-Content "D:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\server.xml"
$pattern = "(?<=.*protocol=""HTTP/1.1"")\w+?(?=connectionTimeout=""20000"".*)"
$Opts = [Regex]::Match($file, $pattern)
提前致谢
答案 0 :(得分:1)
这很简单
PS>[xml]$x=gc "D:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\server.xml"
PS>$x.xml.Connector.maxConnections
3000
PS>$x.xml.Connector.maxThreads
600
如果你有几个连接器可以做
$x.xml.Connector | ?{ $_.port -eq "8080"} |select maxthreads