Elasticsearch 集群部署

1、复制es的安装文件,注意,将其中的data目录删除。以本机三个节点为例。

2、配置每个节点

添加配置信息:

node1配置信息:

cluster.name: my_ES_cluster
node.name: es_node1
network.host: 127.0.0.1
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]

node2配置信息:

cluster.name: my_ES_cluster
node.name: es_node2
network.host: 127.0.0.1
http.port: 9202
transport.tcp.port: 9302
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]

node3配置信息:

cluster.name: my_ES_cluster
node.name: es_node3
network.host: 127.0.0.1
http.port: 9203
transport.tcp.port: 9303
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]

3、配置完成!

4、测试

1)启动 elasticsearch-head-master>grunt server

2)访问http://localhost:9100/

3)出现以下,搭建成功!

新建索引库

通过postman工具创建索引库

{
	"mappings":{
		"article":{
			"properties":{
				"id":{
					"type":	"long",
					"store":true
				},
				"title":{
					"type":"text",
					"store":true,
					"index":true,
					"analyzer":"standard"
				},
				"content":{
					"type":"text",
					"store":true,
					"index":true,
					"analyzer":"standard"
				}
			}
		}
	}
}

添加数据

{
	"id":1,
	"name":"elasticsearch",
	"text":"测试往es集群中插入数据"
	
}

查询数据

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值