elasticsearch7.70 集群 和ik安装

做集群

修改配置文件elasticsearch.yml

cluster.name: my-es
node.name: node-1
node.master: true
node.data: true
http.port: 9200
transport.tcp.port: 9300
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "127.0.0.1:8300"]
node.max_local_storage_nodes: 2
#discovery.zen.ping_timeout: 30s #设置超时时间,一般来说网络不是很稳定的话设置长一点
#discovery.zen.minimum_master_nodes: 2 #至少要发现集群中能做master的节点数,配置n(es节点的个数)/2防止脑裂,选举在机器大于3的时候。


path.data: /data/elasticsearch

path.logs: /usr/local/ELK/elasticsearch/logs

discovery.zen.minimum_master_nodes: 2

http.cors.enabled: true
http.cors.allow-origin: "*"

复制整个文件夹再次修改文件

cluster.name: my-es
node.name: node-2
node.master: true
node.data: true
http.port: 8200
transport.tcp.port: 8300
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "127.0.0.1:8300"]
node.max_local_storage_nodes: 2
#discovery.zen.ping_timeout: 30s #设置超时时间,一般来说网络不是很稳定的话设置长一点
#discovery.zen.minimum_master_nodes: 2 #至少要发现集群中能做master的节点数,配置n(es节点的个数)/2防止脑裂,选举在机器大于3的时候。


path.data: /data/elasticsearch

path.logs: /usr/local/ELK/elasticsearch/logs

discovery.zen.minimum_master_nodes: 2

http.cors.enabled: true
http.cors.allow-origin: "*"

集成ik

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.7.0/elasticsearch-analysis-ik-7.7.0.zip

创建索引

{
  "settings": {
    "number_of_shards": 3,
    "number_of_replicas": 1,
	"analysis":{   
      "analyzer":{
        "ik":{
          "tokenizer":"ik_max_word"
        }
      }
    }
  },
  "mappings": {
    "properties": {
		"praise_rate": {"type": "double"},
		"discription": {"type":"text","analyzer": "ik_max_word"},
		"create_time": {"format": "strict_date_optional_time||epoch_millis","type": "date"},
		"level": {"type": "long"},
		"author": {"analyzer": "ik_smart",		"type": "text"},
		"isbn": {"type": "text"},
		"language": {"type": "long"},
		"type": {"type": "long"},
		"is_delete": {"type": "long"},
		"reader_number": {"type": "long"},
		"imgurl": {"type": "text"},
		"recommend_number": {"type": "long"},
		"score": {"type": "long"},
		"update_time": {"format": "strict_date_optional_time||epoch_millis","type": "date"},
		"word_count": {"type": "long"},
		"price": {"type": "double"},
		"name": {"analyzer": "ik_max_word","type": "text"},
		"publishdate": {"format": "strict_date_optional_time||epoch_millis","type": "date"},
		"publisher": {"type": "text"},
		"id": {"type": "long"},
		"state": {"type": "long"},
		"page_count": {"type": "long"}
	  }		
  }
}

验证

_analyze

{
  "analyzer": "ik_smart",
  "text": "中国人富强"
}

{
  "analyzer": "ik_max_word",
  "text": "中国人富强"
}

elasticsearch-sql安装

https://github.com/NLPchina/elasticsearch-sql
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值