

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# haproxy 属性
<a name="attributes-recipes-haproxy"></a>

**重要**  
该 AWS OpsWorks Stacks 服务于 2024 年 5 月 26 日终止，新客户和现有客户均已禁用。我们强烈建议客户尽快将其工作负载迁移到其他解决方案。如果您对迁移有疑问，请通过 re [AWS : Post 或通过 Pre](https://repost.aws/) mium Su [AWS pp](https://aws.amazon.com/support) ort 与 AWS 支持 团队联系。

**注意**  
这些属性仅在 Linux 堆栈上可用。

这些[`haproxy`属性](https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/haproxy/attributes/default.rb)指定[HAProxy 服务器](http://haproxy.1wt.eu/)配置。有关更多信息，请参阅[HAProxy文档](http://cbonte.github.io/haproxy-dconv/configuration-1.5.html)。有关如何覆盖内置属性以指定自定义值的更多信息，请参阅 [覆盖属性](workingcookbook-attributes.md)。


****  

|  |  |  | 
| --- |--- |--- |
| [balance ](#attributes-recipes-haproxy-balance) | [check\$1interval ](#attributes-recipes-haproxy-interval) | [client\$1timeout ](#attributes-recipes-haproxy-client-timeout) | 
| [connect\$1timeout ](#attributes-recipes-haproxy-connect-timeout) | [default\$1max\$1connections ](#attributes-recipes-haproxy-default-max) | [global\$1max\$1connections ](#attributes-recipes-haproxy-global-max) | 
| [health\$1check\$1method ](#attributes-recipes-haproxy-health-method) | [health\$1check\$1url ](#attributes-recipes-haproxy-health-url) | [queue\$1timeout ](#attributes-recipes-haproxy-queue-timeout) | 
| [http\$1request\$1timeout ](#attributes-recipes-haproxy-http-timeout) | [maxcon\$1factor\$1nodejs\$1app ](#attributes-recipes-haproxy-nodejs-app) | [maxcon\$1factor\$1nodejs\$1app\$1ssl ](#attributes-recipes-haproxy-nodejs-ssl) | 
| [maxcon\$1factor\$1php\$1app ](#attributes-recipes-haproxy-php-app) | [maxcon\$1factor\$1php\$1app\$1ssl ](#attributes-recipes-haproxy-php-ssl) | [maxcon\$1factor\$1rails\$1app ](#attributes-recipes-haproxy-rails-app) | 
| [maxcon\$1factor\$1rails\$1app\$1ssl ](#attributes-recipes-haproxy-rails-ssl) | [maxcon\$1factor\$1static ](#attributes-recipes-haproxy-static-app) | [maxcon\$1factor\$1static\$1ssl ](#attributes-recipes-haproxy-static-ssl) | 
| [重试 ](#attributes-recipes-haproxy-retries) | [server\$1timeout ](#attributes-recipes-haproxy-server-timeout) | [stats\$1url ](#attributes-recipes-haproxy-stats-url) | 
| [stats\$1user ](#attributes-recipes-haproxy-user) |  |  | 

**balance **  <a name="attributes-recipes-haproxy-balance"></a>
负载均衡器用来选择服务器的算法 (字符串)。默认值为 `'roundrobin'`。其他选项是：  
+ 'static-rr'
+ 'leastconn'
+ 'source'
+ 'uri'
+ 'url\$1param'
+ 'hdr(name)'
+ 'rdp-cookie'
+ 'rdp-cookie(name)'
有关这些参数的更多信息，请参阅 [balance](http://cbonte.github.io/haproxy-dconv/configuration-1.5.html)。  

```
node[:haproxy][:balance]
```

**check\$1interval **  <a name="attributes-recipes-haproxy-interval"></a>
运行状况检查时间间隔 (字符串)。默认值为 `'10s'`。  

```
node[:haproxy][:check_interval]
```

**client\$1timeout **  <a name="attributes-recipes-haproxy-client-timeout"></a>
客户端可以处于非活动状态的最长时间 (字符串)。默认值为 `'60s'`。  

```
node[:haproxy][:client_timeout]
```

**connect\$1timeout **  <a name="attributes-recipes-haproxy-connect-timeout"></a>
等待服务器连接尝试成功的最长时间（字符串）。 HAProxy 默认值为 `'10s'`。  

```
node[:haproxy][:connect_timeout]
```

**default\$1max\$1connections **  <a name="attributes-recipes-haproxy-default-max"></a>
默认的最大连接数 (字符串)。默认值为 `'80000'`。  

```
node[:haproxy][:default_max_connections]
```

**global\$1max\$1connections **  <a name="attributes-recipes-haproxy-global-max"></a>
最大连接数 (字符串)。默认值为 `'80000'`。  

```
node[:haproxy][:global_max_connections]
```

**health\$1check\$1method **  <a name="attributes-recipes-haproxy-health-method"></a>
运行状况检查方法 (字符串)。默认值为 `'OPTIONS'`。  

```
node[:haproxy][:health_check_method]
```

**health\$1check\$1url **  <a name="attributes-recipes-haproxy-health-url"></a>
用于检查服务器运行状况的 URL 路径 (字符串)。默认值为 `'/'`。  

```
node[:haproxy][:health_check_url ]
```

**queue\$1timeout **  <a name="attributes-recipes-haproxy-queue-timeout"></a>
等待免费连接的最长时间 (字符串)。默认值为 `'120s'`。  

```
node[:haproxy][:queue_timeout]
```

**http\$1request\$1timeout **  <a name="attributes-recipes-haproxy-http-timeout"></a>
等待完成 HTTP 请求的最长时间（字符串）。 HAProxy 默认值为 `'30s'`。  

```
node[:haproxy][:http_request_timeout]
```

**重试 **  <a name="attributes-recipes-haproxy-retries"></a>
服务器连接失败后的重试次数 (字符串)。默认值为 `'3'`。  

```
node[:haproxy][:retries]
```

**server\$1timeout **  <a name="attributes-recipes-haproxy-server-timeout"></a>
客户端可以处于非活动状态的最长时间 (字符串)。默认值为 `'60s'`。  

```
node[:haproxy][:server_timeout]
```

**stats\$1url **  <a name="attributes-recipes-haproxy-stats-url"></a>
统计信息页面的 URL 路径 (字符串)。默认值为 `'/haproxy?stats'`。  

```
node[:haproxy][:stats_url]
```

**stats\$1user **  <a name="attributes-recipes-haproxy-user"></a>
统计信息页面用户名称 (字符串)。默认值为 `'opsworks'`。  

```
node[:haproxy][:stats_user]
```

这些`maxcon`属性表示负载因子乘数，用于计算 HAProxy 允许[后端](attributes-json-opsworks-instance.md#attributes-json-opsworks-instance-backends)的最大连接数。例如，假设您在一个`backend`值为 4 的小实例上有一个 Rails 应用程序服务器，这意味着 OpsWorks Stacks 将为该实例配置四个 Rails 进程。如果使用默认`maxcon_factor_rails_app`值 7，则 HAProxy 将处理与 Rails 服务器的 28 (4\$17) 个连接。

**maxcon\$1factor\$1nodejs\$1app **  <a name="attributes-recipes-haproxy-nodejs-app"></a>
Node.js 应用程序服务器的 maxcon 因子 (数字)。默认值为 `10`。  

```
node[:haproxy][:maxcon_factor_nodejs_app]
```

**maxcon\$1factor\$1nodejs\$1app\$1ssl **  <a name="attributes-recipes-haproxy-nodejs-ssl"></a>
使用 SSL 的 Node.js 应用程序服务器的 maxcon 因子 (数字)。默认值为 `10`。  

```
node[:haproxy][:maxcon_factor_nodejs_app_ssl]
```

**maxcon\$1factor\$1php\$1app **  <a name="attributes-recipes-haproxy-php-app"></a>
PHP 应用程序服务器的 maxcon 因子 (数字)。默认值为 `10`。  

```
node[:haproxy][:maxcon_factor_php_app]
```

**maxcon\$1factor\$1php\$1app\$1ssl **  <a name="attributes-recipes-haproxy-php-ssl"></a>
使用 SSL 的 PHP 应用程序服务器的 maxcon 因子 (数字)。默认值为 `10`。  

```
node[:haproxy][:maxcon_factor_php_app_ssl]
```

**maxcon\$1factor\$1rails\$1app **  <a name="attributes-recipes-haproxy-rails-app"></a>
Rails 应用程序服务器的 maxcon 因子 (数字)。默认值为 `7`。  

```
node[:haproxy][:maxcon_factor_rails_app]
```

**maxcon\$1factor\$1rails\$1app\$1ssl **  <a name="attributes-recipes-haproxy-rails-ssl"></a>
使用 SSL 的 Rails 应用程序服务器的 maxcon 因子 (数字)。默认值为 `7`。  

```
node[:haproxy][:maxcon_factor_rails_app_ssl]
```

**maxcon\$1factor\$1static **  <a name="attributes-recipes-haproxy-static-app"></a>
静态 Web 服务器的 maxcon 因子 (数字)。默认值为 `15`。  

```
node[:haproxy][:maxcon_factor_static]
```

**maxcon\$1factor\$1static\$1ssl **  <a name="attributes-recipes-haproxy-static-ssl"></a>
使用 SSL 的静态 Web 服务器的 maxcon 因子 (数字)。默认值为 `15`。  

```
node[:haproxy][:maxcon_factor_static_ssl]
```