Where is the configuration file
The configuration file is placed at /etc/default/elasticsearch.
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
这个在marvel里头可以看到是明确生效的,确实是只有一个shard了。
让配置文件生效
restart anyhow 然后在marvel里头是可以看到的