2、Elasticsearch介绍及集群搭建
文章摘自课程链接:https://study.163.com/course/introduction/1005164019.htm1、ES数据简单操作
关系型数据库于ES对比

创建索引
curl -XPUT'http://172.31.44.210:9200/test_index?pretty’
{ "acknowledged" : true, "shards_acknowledged" : true, "index" : "test_index" }
查询索引
curl 'http://172.31.44.210:9200/_cat/indices?v'
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test_index KgyMcRvAStSEvtB_-9sL2w 5 1 0 0 460b 460b
删除索引
curl -XDELETE 'http://172.31.44.210:9200/test_index?pretty’ { "acknowledged": true }
2、head插件安装
git clonegit://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
open http://localhost:9100/
如果执行提示没有npm命令,需要npm工具。并且安装一下nodejs,这样head插件就可以运行
yum -y install git npm
yum -y install nodejs
远程访问
开启跨域访问并赋予权限:/etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
3、head的操作-增删改查
视频中是操作演示,基本都是图形界面
4、ES集群搭建
第二台加入的ES服务器也需要安装Elasticsearch;版本需要与同一集群里其他服务器相同;Ver 6.2.2
elasticsearch.yml文件配置
grep -v ^# /etc/elasticsearch/elasticsearch.yml
cluster.name: my-NCMB
node.name: node-1
path.data: /esdata
path.logs: /esdata
network.host: 172.31.44.210
http.port: 9200