🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
如果你需要在同一个进程中运行不止一个管道,Logstash提供了一种方法,通过一个叫做`pipelines.yml`的配置文件.这个文件必须放在`path.settings`指定的目录(通过命令行可以指定此目录的位置,默认配置参考之前的Logstash目录布局.)并且文件内容遵循以下结构. ```yaml - pipeline.id: my-pipeline_1 path.config: "/etc/path/to/p1.config" pipeline.workers: 3 - pipeline.id: my-other-pipeline path.config: "/etc/different/path/p2.cfg" queue.type: persisted ``` 这个文件使用了YAML格式,包含一个字典列表,每个字典描述一个管道,每个键值对定义一个所在管道的设置项.示例显示了由他们的ID描述的两个不同的管道和配置路径. 对于第一个管道,`pipeline.workers`设置为3,而另外一个,则启用了队列功能.在`pipelines.yml`文件中没有明确定义的设置,将会使用`logstash.yml`[设置文件](https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html)指定的默认设定. 如果你在启动Logstash的时候没有加参数,它将会读取`logstash.yml`并实例化其中定义的所有管道.另一方面,如果你使用`-e`或`-f`,Logstash将会忽略`pipeline.yml`文件并输出一个相关警告日志. #### 使用的注意事项 如果当前配置的事件流不共享相同的inputs/filters和outputs,并且使用标签和条件将它们彼此分开,则使用多个管道尤其有用。 在单个实例中有多个管道还允许这些事件流具有不同的性能和持久性参数(比如,不同数量的pipeline workers和持久化队列).这种分离意味着,一个管道output阻塞不会在另一个管道产生压力. 这就是说,考虑到管道之间的资源分配是很重要的,要对单个管道的默认值进行调优.比如,可以考虑降低每个管道中worker的数量.因为默认情况下每个管道中的每个worker都需要占用一个CPU内核. 原文:That said, it’s important to take into account resource competition between the pipelines, given that the default values are tuned for a single pipeline. So, for example, consider reducing the number of pipeline workers used by each pipeline, because each pipeline will use 1 worker per CPU core by default. 持久化队列和死信队列是单独隔离的管道.有自己本地的通过`pipeline.id`定义的名称空间.原文:Persistent queues and dead letter queues are isolated per pipeline, with their locations namespaced by the `pipeline.id` value.