yum安装
在/etc/yum.repos.d/下新建文件elasticsearch.repo,内容:
[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
执行安装命令:
yum install elasticsearch
设置开机启动:
chkconfig --add elasticsearch
启动和停止:
service elasticsearch start
service elasticsearch stop
测试:
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"]
变更数据存放路径
修改配置文件
vi /etc/elasticsearch/elasticsearch.yml
修改字段值:
path.data: /home/elasticsearch/data
迁移文件:
cp -r /var/lib/elasticsearch/nodes/* /home/elasticsearch/data/nodes/
设置权限:
cd /home/elasticsearch/
chown -R elasticsearch:elasticsearch *