yum安裝
在/etc/yum.repos.d/下新建文件elasticsearch.repo,內(nèi)容:
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
執(zhí)行安裝命令:
yum install elasticsearch
設(shè)置開(kāi)機(jī)啟動(dòng):
chkconfig --add elasticsearch
啟動(dòng)和停止:
service elasticsearch start
service elasticsearch stop
測(cè)試:
curl -X GET "localhost:9200/"
文件路徑
Type | Description | Default Location | Setting |
---|---|---|---|
home | Elasticsearch home directory or $ES_HOME
|
/usr/share/elasticsearch |
|
bin | Binary scripts including elasticsearch to start a node and elasticsearch-plugin to install plugins |
/usr/share/elasticsearch/bin |
|
conf | Configuration files including elasticsearch.yml
|
/etc/elasticsearch |
|
conf | Environment variables including heap size, file descriptors. | /etc/sysconfig/elasticsearch |
|
data | The location of the data files of each index / shard allocated on the node. Can hold multiple locations. | /var/lib/elasticsearch |
path.data |
logs | Log files location. | /var/log/elasticsearch |
path.logs |
plugins | Plugin files location. Each plugin will be contained in a subdirectory. | /usr/share/elasticsearch/plugins |
|
repo | Shared file system repository locations. Can hold multiple locations. A file system repository can be placed in to any subdirectory of any directory specified here. | Not configured | path.repo |
配置
vi /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
變更數(shù)據(jù)存放路徑
修改配置文件
vi /etc/elasticsearch/elasticsearch.yml
修改字段值:
path.data: /home/elasticsearch/data
遷移文件:
cp -r /var/lib/elasticsearch/nodes/* /home/elasticsearch/data/nodes/
設(shè)置權(quán)限:
cd /home/elasticsearch/
chown -R elasticsearch:elasticsearch *