首页   快速返回

elasticsearch5.0配置     所属分类 elasticsearch
根据原文翻译整理
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/settings.html

配置 
Elasticsearch ships with good defaults and requires very little configuration. 
Most settings can be changed on a running cluster using the Cluster Update Settings API.

具有良好的默认设置,只需要很少的配置。可以使用 集群更新设置API 在运行时配置

elasticsearch.yml
log4j2.properties

命令行指定配置文件
./bin/elasticsearch -Epath.conf=/path/to/my/config/

配置文件格式  YAML 

path:
    data: /var/elasticsearch/data
    logs: /var/elasticsearch/logs
    
path.data: /var/elasticsearch/data
path.logs: /var/elasticsearch/logs


配置文件可以引用环境变量值

node.name:    ${HOSTNAME}
network.host: ${ES_NETWORK_HOST}

前台启动可以在命令行 交互式 输入 变量值

${prompt.secret}
${prompt.text}
node.name: ${prompt.text}
Enter value for [node.name]:

Elasticsearch will not start if ${prompt.text} or ${prompt.secret} 
is used in the settings and the process is run as a service or in the background.

以服务或后台方式运行,将无法启动

默认配置  使用  default前缀 
配置文件中如果没有指定 则使用默认值 
./bin/elasticsearch -Edefault.node.name=My_Node

the value for node.name will be My_Node, 
unless it is overwritten on the command line with es.node.name or in the config file with node.name.
命令行或配置文件的配置会覆盖默认值

日志配置 
Log4j 2 can be configured using the log4j2.properties file
${sys:es.logs}  
if your log directory (path.logs) is /var/log/elasticsearch and your cluster is named production 
then ${sys:es.logs} will resolve to /var/log/elasticsearch/production.

appender.rolling.type = RollingFile 
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs}.log 
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %.10000m%n
appender.rolling.filePattern = ${sys:es.logs}-%d{yyyy-MM-dd}.log 
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy 
appender.rolling.policies.time.interval = 1 
appender.rolling.policies.time.modulate = true 


Configure the RollingFile appender
Log to /var/log/elasticsearch/production.log
Roll logs to /var/log/elasticsearch/production-yyyy-MM-dd.log
Using a time-based roll policy  按时间滚动
Roll logs on a daily basis
Align rolls on the day boundary (as opposed to rolling every twenty-four hours)

日志滚动 
 
If you append .gz or .zip to appender.rolling.filePattern, then the logs will be compressed as they are rolled.
滚动日志压缩 

加载多份配置文件 合并

把ES配置目录作为祖先目录  其他插件暴露日志接口
The logger section contains the java packages and their corresponding log level.

logger.deprecation.level = warn

he default logging configuration has set the roll policy for the deprecation logs to roll and compress after 1 GB, 
and to preserve a maximum of five log files (four rolled logs, and the active log).

默认的日志配置  滚动 超过1G时压缩 , 最多保留5个日志 ,4个滚存的,一个活跃的日志文件

上一篇     下一篇
网站运营推广之七言绝句

elasticsearch5.0使用RPM包安装

elasticsearch5.0安装

elasticsearch5.0的重要配置

elasticsearch5.0启动检查

elasticsearch5.0重要系统配置