Elasticsearch配置

配置文件位置

rpm和Debian安裝包默認(rèn)放在/etc/elasticserach下面。
如果你自己下載java包到/data(注意elasticserach需要java se環(huán)境)撬槽,那么之后根據(jù)官方文檔的也會放在/data下襟齿。

你也可以修配置文件的位置

./bin/elasticsearch -Epath.conf=/path/to/my/config/

配置文件格式:

下面修改數(shù)據(jù)和日志存放的目錄

path: data: /var/lib/elasticsearch 
logs: /var/log/elasticsearch

也可以這樣子寫

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

環(huán)境變量的替代

環(huán)境變量設(shè)置的格式為${...},
例如

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

第一個修改節(jié)點(diǎn)的名字澎灸,第二個修改可訪問到該節(jié)點(diǎn)的IP炸宵。

即時設(shè)置:(不會被寫進(jìn)去配置文件中)

我們可以使用

${promp.text}
${promp.secret}

在前臺中開啟elasticsearch瓜客,使用prompt.secret時俭正,在終端輸入的內(nèi)容不會顯示出來,提高安全性掸读。

例子:

node: name: ${prompt.text}

當(dāng)我們開啟elasticsearch之后串远,會讓你輸入節(jié)點(diǎn)的名字

Enter value for [node.name]:
注意:Elasticsearch不會把${prompt.text}或者${prompt.secret}的設(shè)置用于service或者background的進(jìn)程宏多。

默認(rèn)設(shè)置

在開啟elasticsearch時,可以在命令行中使用

default.

前綴使用默認(rèn)設(shè)置澡罚,如下:

./bin/elasticsearch -Edefault.node.name=My_Node

節(jié)點(diǎn)的名字就是My_Node伸但。當(dāng)然我們也可以直接在config直接修改或者在命令行下重寫節(jié)點(diǎn)名字。(使用es.node.name)

日志輸出配置

Elasticseach使用

Log4j 2
http://logging.apache.org/log4j/2.x/

的格式來輸出日志留搔。
我們可以使用Log4j 2屬性文件來配置Log4j 2 更胖。Elasticsearch開放一個屬性

${sys:es.logs}

這個可以在配置文件中找到,它是用于設(shè)置日志文件存放的目錄隔显。在runtime時這個路徑會成為Elasticsearch log目錄的前綴却妨。

舉個例子:如果你的日志目錄(path.logs)是

/var/log/elasticsearch

然后你的cluster的名字是production,那么${sys:es.logs}將會是

/var/log/elasticsearch/production
appender.rolling.type = RollingFile  #1
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs}.log  #2
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 #3
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy #4
appender.rolling.policies.time.interval = 1 #5
appender.rolling.policies.time.modulate = true #6

1:Configure the RollingFile appender
2:日志輸出到 /var/log/elasticsearch/production.log
3:Roll logs to /var/log/elasticsearch/production-yyyy-MM-dd.log
4:Using a time-based roll policy
5:Roll logs on a daily basis
6:Align rolls on the day boundary (as opposed to rolling every twenty-four hours)

如果你添加.gz或者.zip到appender.roolling.filePattern,那么日志將會被壓縮

Multiple configuration files can be loaded (in which case they will get merged) as long as they are named log4j2.properties
and have the Elasticsearch config directory as an ancestor; this is useful for plugins that expose additional loggers. The logger section contains the java packages and their corresponding log level. The appender section contains the destinations for the logs. Extensive information on how to customize logging and all the supported appenders can be found on the Log4j documentation.

Deprecation logging

名詞解釋:"A deprecation log has been introduced to track calls to deprecated/outdated methods in the TYPO3 Core. Developers have to make sure to adjust their code to avoid using this old functionality since deprecated methods will be removed in future TYPO3 releases! The information can be found in /typo3conf/deprecation_[hash-value].log The install tool has a setting "enableDeprecationLog" that allows one to disable the logging of deprecation messages since the file might grow quite fast depending on the extensions installed."

為了能夠正常地進(jìn)行日志輸出,Elasticsearch允許你使用廢棄的(過時的)
方法括眠。默認(rèn)地管呵,deprecation logging 能夠在WRAN等級下使用:

logger.deprecation.level = warn

詳情參考:

https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#logging

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市哺窄,隨后出現(xiàn)的幾起案子捐下,更是在濱河造成了極大的恐慌,老刑警劉巖萌业,帶你破解...
    沈念sama閱讀 222,183評論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件坷襟,死亡現(xiàn)場離奇詭異,居然都是意外死亡生年,警方通過查閱死者的電腦和手機(jī)婴程,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,850評論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來抱婉,“玉大人档叔,你說我怎么就攤上這事≌艏ǎ” “怎么了衙四?”我有些...
    開封第一講書人閱讀 168,766評論 0 361
  • 文/不壞的土叔 我叫張陵,是天一觀的道長患亿。 經(jīng)常有香客問我传蹈,道長,這世上最難降的妖魔是什么步藕? 我笑而不...
    開封第一講書人閱讀 59,854評論 1 299
  • 正文 為了忘掉前任惦界,我火速辦了婚禮,結(jié)果婚禮上咙冗,老公的妹妹穿的比我還像新娘沾歪。我一直安慰自己,他們只是感情好雾消,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,871評論 6 398
  • 文/花漫 我一把揭開白布灾搏。 她就那樣靜靜地躺著挫望,像睡著了一般。 火紅的嫁衣襯著肌膚如雪确镊。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,457評論 1 311
  • 那天范删,我揣著相機(jī)與錄音蕾域,去河邊找鬼。 笑死到旦,一個胖子當(dāng)著我的面吹牛旨巷,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播添忘,決...
    沈念sama閱讀 40,999評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼采呐,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了搁骑?” 一聲冷哼從身側(cè)響起斧吐,我...
    開封第一講書人閱讀 39,914評論 0 277
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎仲器,沒想到半個月后煤率,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,465評論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡乏冀,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,543評論 3 342
  • 正文 我和宋清朗相戀三年蝶糯,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片辆沦。...
    茶點(diǎn)故事閱讀 40,675評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡昼捍,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出肢扯,到底是詐尸還是另有隱情妒茬,我是刑警寧澤,帶...
    沈念sama閱讀 36,354評論 5 351
  • 正文 年R本政府宣布蔚晨,位于F島的核電站郊闯,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏蛛株。R本人自食惡果不足惜团赁,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,029評論 3 335
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望谨履。 院中可真熱鬧欢摄,春花似錦、人聲如沸笋粟。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,514評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至绿淋,卻和暖如春闷畸,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背吞滞。 一陣腳步聲響...
    開封第一講書人閱讀 33,616評論 1 274
  • 我被黑心中介騙來泰國打工佑菩, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人裁赠。 一個月前我還...
    沈念sama閱讀 49,091評論 3 378
  • 正文 我出身青樓殿漠,卻偏偏與公主長得像,于是被迫代替她去往敵國和親佩捞。 傳聞我的和親對象是個殘疾皇子绞幌,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,685評論 2 360

推薦閱讀更多精彩內(nèi)容