ElasticSearch 在内存受限系统的配置

Where is the configuration file

The configuration file is placed at /etc/default/elasticsearch.

Official Guide

The meaning of the parameters are also here.

Limit the memory usage

/etc/default/elasticsearch

# Heap Size (defaults to 256m min, 1g max)
ES_HEAP_SIZE=384m # 这个会使得Xmx 和Xms同时为384m

# Heap new generation
#ES_HEAP_NEWSIZE=

# max direct memory
#ES_DIRECT_SIZE=

# Maximum number of open files, defaults to 65535.
#MAX_OPEN_FILES=65535

# Maximum locked memory size. Set to "unlimited" if you use the
# bootstrap.mlockall option in elasticsearch.yml. You must also set
# ES_HEAP_SIZE.
MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
#MAX_MAP_COUNT=262144

# Elasticsearch log directory
#LOG_DIR=/var/log/elasticsearch

# Elasticsearch data directory
#DATA_DIR=/var/lib/elasticsearch

# Elasticsearch work directory
#WORK_DIR=/tmp/elasticsearch

# Elasticsearch configuration directory
#CONF_DIR=/etc/elasticsearch

# Elasticsearch configuration file (elasticsearch.yml)
#CONF_FILE=/etc/elasticsearch/elasticsearch.yml

# Additional Java OPTS
#ES_JAVA_OPTS=

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

但是这个没有看出来生效了啊... => 一定要用service启动才会生效的, 详情可以看一下 /etc/init.d/elasticsearch ,里头写得很清楚了,上面那个文档也说得很清楚

所以就用

/etc/init.d/elasticsearch start

就好的了,marvel就可以看到memory是384m。 特别注意的是,这个时候要配置conf的路径

Less nodes and replica

/usr/share/elasticsearch/conf/elasticsearch.yml




index.number_of_shards: 1

index.number_of_replicas: 0  # See explanation below

bootstrap.mlockall: true

ElasticSearch-Configuration

这个在marvel里头可以看到是明确生效的,确实是只有一个shard了。

让配置文件生效

restart anyhow 然后在marvel里头是可以看到的

转载于:https://my.oschina.net/zuoyc/blog/417387

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值