Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dist_sysconf_DATA = \
ip_allow.config.default \
logging.yaml.default \
parent.config.default \
parent.yaml.default \
plugin.config.default \
remap.config.default \
socks.config.default \
Expand Down
165 changes: 165 additions & 0 deletions configs/parent.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
Comment thread
jrushford marked this conversation as resolved.
"title": "Traffic Server parents configuration",
"description": "parent configuration file structure. Licensed under Apache V2 https://www.apache.org/licenses/LICENSE-2.0",
"type": "object",
"properties": {
"parents": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"dest_domain": {
"description": "A requested domain name, and its subdomains.",
"type": "string"
},
"dest_host": {
"description": "A requested hostname.",
"type": "string"
},
"dest_ip": {
"description": "A requested IP address or range of IP addresses separated by a dash (-)..",
"type": "string"
},
"url_regex": {
"description": "A regular expression (regex) to be found in a URL.",
"type": "string"
},
"internal": {
"description": "A boolean value, true or false, specifying if the rule should match (or not match) a transaction originating from an internal API.",
"type": "boolean"
},
"go_direct": {
"description": "send the request directly to the origin bypassing the parent list.",
"type": "boolean"
},
"max_simple_retries": {
"description": "The maximum number of retries for a simple retry.",
"type": "number",
"minimum": 1,
"maximum": 5
},
"max_unavailable_server_retries": {
"description": "The maximum number of retries for an unavailable server retry.",
"type": "number",
"minimum": 1,
"maximum": 5
},
"method": {
"description": "A request URL method",
"type": "string",
"enum": [
"get",
"post",
"put",
"trace"
]
},
"parent_retry": {
"description": "Use one or both of 'simple_retry', or 'unavailable_server_retry'",
"type": "string",
"enum": [
"simple_retry",
"unavailable_server_retry",
"both"
]
},
"parent_is_proxy": {
"description": "The parents listed in parent and secondary_parent are caching proxies, set to false if they are origins",
"type": "boolean"
},
"port": {
"description": "A requested URL port.",
"type": "number"
},
"prefix": {
"description": "A prefix in the path part of a URL.",
"type": "string"
},
"qstring": {
"description": "use or ignore the query string when looking up a parent with consistent_hash",
"type": "string",
"enum": [
"consider",
"ignore"
]
},
"round_robin": {
"description": "select to use one of the parent strategy algorithms, default is 'false'",
"enum": [
"true",
"false",
"strict",
"consistent_hash",
"latched"
]
},
"scheme": {
"description": "A request URL method.",
"type": "string",
"enum": [
"http",
"https"
]
},
"secondary_mode": {
"description": "The secondary parent list mode (see parent.config doc), defaults to 1.",
"type": "number",
"minimum": 1,
"maximum": 3
},
"src_ip": {
"description": "A client IP address.",
"type": "string"
},
"suffix": {
"description": "A file suffix in the URL.",
"type": "string"
},
"time": {
"description": "A time range, such as 08:00-14:00, during which the parent cache is used to serve requests.",
"type": "string"
},
"parent": {
"description": "list of primary parents",
"type": "string"
},
"secondary_parent": {
"description": "list of secondary parents",
"type": "string"
},
"unavailable_server_retry_responses": {
"description": "When using unavailable_server retry, use this to specify a csv separated list of 5xx resposne codes, default is '503'",
"type": "string"
}
},
"oneOf": [
{
"required": [
"dest_domain"
]
},
{
"required": [
"dest_host"
]
},
{
"required": [
"dest_ip"
]
},
{
"required": [
"url_regex"
]
}
]
}
}
},
"additionalProperties": false,
"required": [
"parents"
]
}
79 changes: 79 additions & 0 deletions configs/parent.yaml.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# parent.yaml
#
# Documentation:
# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/parent.config.en.html
#
# The purpose of this file is to specify the parent proxy for
# specific objects or sets of objects
#
# This is the yaml version of the parent.config. Set 'proxy.config.http.parent_proxy.file'
# to 'parent.yaml' to use a yaml formatted configuration, ie:
#
# CONFIG proxy.config.http.parent_proxy.file STRING parent.yaml
#
# All entries are part of a yaml sequence, both sequence formats are supported, see below.
#
# Each record must include exactly one primary specifier
#
# Primary destination specifiers are
# dest_domain:
# dest_host:
# dest_ip:
# url_regex:
#
#
# record may include any number of the secondary specifiers but
# secondary specifiers may not be duplicated in the same record
#
# Secondary specifiers are
# port:
# scheme:
# prefix:
# suffix:
# method:
# time:
# src_ip:
# internal: {true,false}
#
# Available parent directives are:
# parent: (a semicolon separated list of parent proxies)
# go_direct: {true,false}
# round_robin: {strict,true,false,consistent_hash,latched}
#
# Note: for round_robin, strict means strict round_robin - parents are
# tried one by one, true means round_robin based on client IP
# addresses, false means no round_robin, consisten_hash means a hash
# algorithm over the url path is used, latched is the same as false
# but will stay latched to a selected parent until it is marked down.
#
# Each line must include a parent: directive or a go_direct:
# directive. If both appear, Traffic Server will directly
# contact the origin server if all the listed parent proxies
# are down
#
# Example for two records one in two different yaml sequence formats:
#
# Alternate requests between proxy1 and proxy2
#
# Sequence Format 1 (2 entries), most readable, dashes matter:
#
# - { dest_domain: "stooges.net", parent: "curly:80|1.0;joe:80|1.0;larry:80|1.0",
# round_robin: "consistent_hash", go_direct: true}
# - { dest_domain: "lucy.net", parent: "ethel:80|1.0;fred:80|1.0;ricky:80|1.0",
# roun_robin: "true", go_direct: false}
#
# Sequence Format 2 (two entries), tabs and dashes matter.
#
# -
# dest_domain: "stooges.net"
# parent: "curly:80|1.0;joe:80|1.0;larry:80|1.0"
# round_robin: "consistent_hash"
# go_direct: true
# -
# dest_domain: "lucy.net"
# parent: "ethel:80|1.0;fred:80|1.0;ricky:80|1.0"
# roun_robin: "true"
# go_direct: false
#
#
18 changes: 14 additions & 4 deletions doc/admin-guide/files/parent.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,34 @@
parent.config
=============

.. configfile:: parent.config
.. configfile:: parent.config, parent.yaml

The :file:`parent.config` file identifies the parent proxies used in an
The :file:`parent.config` or optionally `parent.yaml` file identifies the parent proxies used in an
cache hierarchy. Use this file to perform the following configuration:

- Set up parent cache hierarchies, with multiple parents and parent
failover
- Configure selected URL requests to bypass parent proxies

Traffic Server uses the :file:`parent.config` file only when the parent
Traffic Server uses the :file:`parent.config` or `parent.yaml` file only when the parent
caching option is enabled (refer to :ref:`configuring-traffic-server-to-use-a-parent-cache`).

After you modify the :file:`parent.config` file, run the :option:`traffic_ctl config reload`
After you modify the :file:`parent.config` or `parent.yaml` file, run the :option:`traffic_ctl config reload`
command to apply your changes.

Format
======

Optionally the parent configuration may be expressed using a yaml configuration file.
To use `parent.yaml`, set the following in `records.config`::

CONFIG proxy.config.http.parent_proxy.file STRING parent.yaml

When Yaml is used, each line as described here become yaml object which
is part of a sequence. For a YAML example configuration file see::

configs/parent.yaml.default

Each line in the :file:`parent.config` file must contain a parent caching
rule. Traffic Server recognizes three space-delimited tags: ::

Expand Down
3 changes: 3 additions & 0 deletions include/tscore/MatcherUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "tscore/ParseRules.h"
#include "tscore/Result.h"
#include "tscore/ink_inet.h"
#include "yaml-cpp/yaml.h"

// Look in MatcherUtils.cc for comments on function usage
char *readIntoBuffer(const char *file_path, const char *module_name, int *read_size_ptr);
Expand Down Expand Up @@ -86,6 +87,7 @@ struct matcher_line {
int num_el; // Number of elements
char *line[2][MATCHER_MAX_TOKENS]; // label, value pairs
int line_num; // config file line number
const YAML::Node *node; // the yaml node if we're parsing yaml
matcher_line *next; // use for linked list
};

Expand Down Expand Up @@ -113,6 +115,7 @@ extern const matcher_tags ip_allow_dest_tags;
extern const matcher_tags socks_server_tags;

const char *parseConfigLine(char *line, matcher_line *p_line, const matcher_tags *tags);
const char *parseYamlDoc(const YAML::Node node, matcher_line *p_line, const matcher_tags *tags);

// inline void LowerCaseStr(char* str)
//
Expand Down
3 changes: 2 additions & 1 deletion iocore/aio/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/iocore/eventsystem \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
$(TS_INCLUDES)
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@

TESTS = test_AIO.sample

Expand Down
3 changes: 2 additions & 1 deletion iocore/cache/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/http/remap \
-I$(abs_top_srcdir)/mgmt \
-I$(abs_top_srcdir)/mgmt/utils \
$(TS_INCLUDES)
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@

noinst_LIBRARIES = libinkcache.a

Expand Down
3 changes: 2 additions & 1 deletion iocore/dns/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/mgmt \
-I$(abs_top_srcdir)/mgmt/utils \
$(TS_INCLUDES)
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@

noinst_LIBRARIES = libinkdns.a

Expand Down
3 changes: 2 additions & 1 deletion iocore/hostdb/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/mgmt \
-I$(abs_top_srcdir)/mgmt/utils \
$(TS_INCLUDES)
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@

EXTRA_DIST = I_HostDB.h

Expand Down
3 changes: 2 additions & 1 deletion mgmt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
$(TS_INCLUDES)
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@

libmgmt_c_la_SOURCES = \
RecordsConfig.cc \
Expand Down
Loading