1 | yum install java-1.8.0-openjdk.x86_64 |
1 | -Xms1g #程序启动时占用内存的大小 |
2 | -Xmx1g #程序启动后最大可占用内存的大小 |
01 | vi /usr/local/elasticsearch-6.7.1/config/elasticsearch.yml |
02 | cluster.name: test_es #集群名称,相同集群名称的节点会自动加入到该集群 |
03 | node.name: node-1_9 #节点名称,这里1_9代表IP最后2段位1.9 |
04 | path.data: /data/es/data #节点数据存储路径 |
05 | path.logs: /data/es/logs #节点日志存储路径 |
06 | node.master: true #配置节点是否能成为master。默认所有节点都是true,建议只一台配置true,其他为False |
07 | node.data: true #配置该节点是否能存储数据,默认为true,推荐把主节点设置为false |
08 | network.host: 10.4.1.9 #修改为节点IP,建议配置为内网地址,一定不能配置0.0.0.0,会导致信息泄露 |
09 | http.port: 9200 #ES端口 |
10 | discovery.zen.ping.unicast.hosts: ["10.4.1.9", "10.4.1.27", "10.4.1.31"] #master节点列表。 |
11 | discovery.zen.minimum_master_nodes:2 #配置主节点数量的最少值,少于该值的话ES集群不可用,为避免脑裂,通常配置为节点数量/2+1,比如使用了三台节点,那么配置应该为2 |
12 | bootstrap.system_call_filter: false #关闭自检程序 |
13 | bootstrap.memory_lock: false |
1 | /usr/local/elasticsearch-6.7.1/bin/elasticsearch -d |
2 | /usr/local/elasticsearch-6.7.1/bin/elasticsearch-plugin list #查看插件 |
1 | * soft nproc 65536 |
2 | * hard nproc 65536 |
3 | * soft nofile 65536 |
4 | * hard nofile 65536 |
1 | * soft nproc 4096 |
2 | * hard nproc 4096 |
1 | http://localhost:9200/_cluster/health #如果状态非green,可以关注unassigned_shard查看未分配的分片数 |
2 | http://localhost:9200/_cluster/health?pretty #加上pretty会将内容格式化再输出,更美观 |
3 |
4 | http://localhost:9200/_cat/health |
5 | http://localhost:9200/_cat/health?v #?v可以让显示信息更详尽 |
6 |
7 | http://localhost:9200/_cluster/state?pretty #可以看主节点信息等 |
8 |
9 | GET /_cluster/allocation/explain #集群red的原因 |
1 | curl http://localhost:9200/_cat/nodes?v |
1 | curl http://localhost:9200/_cat/indices?v |
1 | curl -XPUT "10.4.0.221:9200/nginx_web_log.2019.03.01" #新增一个索引nginx_web_log.2019.03.01 |
2 | curl -XPUT "10.4.0.221:9200/nginx_web_log.2019.03.01/users/1{ |
3 | "name":"tanglu", |
4 | "age": 30 |
5 | }" |
1 | curl -XDELETE http://10.4.0.221:9201/nginx_web_log.2019.03.* #支持通配符 |
1 | elasticdump --input=http://源IP:9200/索引名 --output=http://目标IP:9200/索引名 --type=settings |
2 | elasticdump --input=http://源IP:9200/索引名 --output=http://目标IP:9200/索引名 --type=mapping |
3 | elasticdump --input=http://源IP:9200/索引名 --output=http://目标IP:9200/索引名 --type=data |
01 | #为blog索引新增两条记录,指定type为article,ID为2和3 |
02 | curl -XPUT -H "Content-Type: application/json"'localhost:9201/blog/article/2?pretty' -d ' |
03 | { |
04 | "title": "test", |
05 | "content":"testsfsdfdsfdsf", |
06 | "PV":10 |
07 | }' |
08 |
09 | curl -XPUT -H "Content-Type: application/json"'localhost:9201/blog/article/3?pretty' -d ' |
10 | { |
11 | "title": "test", |
12 | "content":"testsfsdfdsfdsf", |
13 | "PV":23 |
14 | }' |
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2018 群英 版权所有 茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号-36 粤公网安备 44090202000006号 粤工商备P091701000595