This environment is operated on Ubuntu 18.04 by default.
We first need to configure the java environment, which requires Java8 or newer packages. Generally, you can check whether the Java version is compatible when you execute the following command:
sudo apt install default-jdk
We need to download and install the public key before installation, otherwise there is no way to install Elasticsearch using apt.
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
First add the source:
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main"| sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
Next, we can update the source to cut Es after all:
sudo apt-get update && sudo apt-get install elasticsearch
This is installed.
We can use the systemd
method for Elasticsearch management
systemd
Set boot up:
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch
start up:
sudo systemctl start elasticsearch
shut down:
sudo systemctl stop elasticsearch
First we need to execute the command to start it (if it has already been started, then there is no need to execute the following start command):
sudo systemctl start elasticsearch
Then execute the following command:
curl -XGET '127.0.0.1:9200/?pretty'
If the returned data is as follows, the installation is successful:
{" name":"NLJug1O","cluster_name":"elasticsearch","cluster_uuid":"hVZpdHvgT9CeE1ywsNt16w","version":{"number":"6.2.4","build_hash":"ccec39f","build_date":"2018-04-12T20:37:28.497551Z","build_snapshot":false,"lucene_version":"7.2.1","minimum_wire_compatibility_version":"5.6.0","minimum_index_compatibility_version":"5.0.0"},"tagline":"You Know, for Search"}
Note: Elasticsearch needs to be started for a while. If you execute the above command immediately after startup, you may be prompted to refuse the connection, just try a few more times.
Elasticsearch loads its configuration from the /etc/elasticsearch/elasticsearch.yml file by default.
RPM also has another system configuration file (/etc/sysconfig/elasticsearch), which allows you to set the following parameters:
Parameters | Explanation |
---|---|
JAVA_HOME | Set the custom Java path to be used |
MAX_OPEN_FILES | Maximum number of open files, default 65536 |
MAX_LOCKED_MEMORY | Maximum lock memory size. If you use bootstrap.memory_lock option in elasticsearch.yml, please set unlimited |
MAX_MAP_COUNT | The maximum value of the memory map area that a process may have. If you use mmapfs as the index storage type, make sure to set it to a higher value. Please check the linux kernel documentation for more information about max_map_count. This is set through sysctl before elasticsearch is started. The default is 262144 |
ES_PATH_CONF | Configuration file directory (need to include elasticsearch.yml and log4j2.properties files), the default path is: /etc/elasticsearch |
ES_JAVA_OPTS | Any additional JVM system properties you may want to apply. |
RESTART_ON_UPGRADE | The configuration package will be restarted when it is upgraded. The default is false. This means you manually restart the elasticsearch instance after installing the package. The reason for this is to ensure that, when updating in the cluster, the redistribution of shards is caused in the case of high-traffic networks and reducing the response time of your cluster. |
Type | Description | Default Path | Settings |
---|---|---|---|
home | Elasticsearch home directory or $ES_HOME | /usr/share/elasticsearch | |
bin | binary script, including elasticsearch to start a node and elasticsearch-plugin to install plugins | /usr/share/elasticsearch/bin | |
conf | Configuration file, including elasticsearch.yml | /etc/elasticsearch | ES_PATH_CONF |
conf | Environmental variables, including heap size, file descriptors. | /etc/default/elasticsearch | |
data | The location of the data file for each index/shard allocated on the node. Can accommodate multiple locations. | /var/lib/elasticsearch | path.data |
logs | Log file location. | /var/log/elasticsearch | path.logs |
plugins | Plugin file location. Each plugin will be contained in a subdirectory. | /usr/share/elasticsearch/plugins | |
repo | Shared file system repository location. Can accommodate multiple locations. The file system repository can be placed in any subdirectory of the specified directory. | Not configured | path.repo |
Recommended Posts