`
sillycat
  • 浏览: 2550706 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

ElasticSearch(4)Manually Elasticsearch Cluster

 
阅读更多
ElasticSearch(4)Manually Elasticsearch Cluster

Follow previous link, start Kibana on ubuntu-master as well.
>bin/elasticsearch -Ecluster.name=laprocluster -Enode.name=elastic1
> bin/kibana

Open Kibana page and go to DEV tool
http://ubuntu-master:5601/app/kibana#/dev_tools/console?_g=()v

In the console, put command
>GET /_cat/health?v

It will give us the cluster information

Node Information Command
>GET /_cat/nodes?v

List the indexes, indices
>GET /_cat/indices?v

Create an index and have a try, create a sample index named customer, just pretty to give the nice JSON response
>PUT /customer?pretty
{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "customer"
}

Check the status of the index
>GET /_cat/indices?v
health status index                uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   customer             Y9ieCh28SuSrVLekAMMrng   1   1          0            0       230b           230b

We create an index named customer with 1 primary and 1 replica, there is only 1 node, so it is yellow.

Index and Query a Document
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-query-document.html

>PUT /customer/_doc/1?pretty
{
  "name": "Carl Luo"
}

PUT /customer/_doc/2?pretty
{
  "name": "Leo Luo"
}

PUT /customer/_doc/3?pretty
{
  "name": "Angela Yuqi Luo"
}

We can fetch the Records
>GET /customer/_doc/1?pretty

Delete an index
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-delete-index.html
>DELETE /customer?pretty

Delete a document
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-delete-documents.html
>DELETE /customer/_doc/3?pretty

We can do batch operation as well
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-batch-processing.html

Here is some links to load the sample data and do some search around that
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-explore-data.html

Manually Set Up Cluster
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/setup.html

Start the ElasticSearch in the daemon
> bin/elasticsearch -d -Ecluster.name=laprocluster -Enode.name=elastic1

https://www.elastic.co/guide/en/elasticsearch/reference/7.0/targz.html

We can save the pid as well
>bin/elasticsearch -d -Ecluster.name=laprocluster -Enode.name=elastic1 -p pid

We can do this later to stop that
>pkill -F pid

Some configuration
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/settings.html
Config files Location
elasticsearch.yml for elasticsearch
jvm.options for JVM
Log4j2.properties for logging

We can change the configuration location if we need
>ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch

Some important configurations
cluster.name: sillycatcluster
node.name: elastic1
path.data: /opt/elasticsearch/data
path.logs: /opt/elasticsearch/logs
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0


JVM Option is in
> vi config/jvm.options
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/jvm-options.html

Adding Nodes to Cluster
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/add-elasticsearch-nodes.html

Setting Up 2 Other Nodes : ubuntu-dev2 and ubuntu-dev4
> java -version
java version "1.8.0_171"

Download the Oracle JDK from here https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Copy the file to my virtual machines.
> scp jdk-8u211-linux-x64.tar.gz ubuntu-dev2:/home/carl/install/

Unzip and place in the working directory
> sudo ln -s /home/carl/tool/jdk1.8.0_211 /opt/jdk1.8.0
> sudo ln -s /opt/jdk1.8.0 /opt/jdk

Add this to .profile
export JAVA_HOME="/opt/jdk"
PATH="/opt/jdk/bin:$PATH"

Install Elasticsearch on Node
> wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-linux-x86_64.tar.gz

> sudo ln -s /home/carl/tool/elasticsearch-7.0.1 /opt/elasticsearch-7.0.1
> sudo ln -s /opt/elasticsearch-7.0.1 /opt/elasticsearch

I am using virtual box with host only adapter, so I can not make it working with 9300
[2019-05-20T14:35:08,876][INFO ][o.e.t.TransportService   ] [elastic1] publish_address {192.168.56.101:9300}, bound_addresses {192.168.56.101:9300}
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

The vm.max_map_count is the issue, not the IP bind.
http://kael-aiur.com/elk/ES%E9%85%8D%E7%BD%AE%E7%BB%99%E5%A4%96%E9%83%A8%E6%9C%BA%E5%99%A8%E9%80%9A%E8%BF%87ip%E8%AE%BF%E9%97%AE.html

> sudo vi /etc/security/limits.conf
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4
carl            -      nofile          65536
> sudo sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144

The configurations are as follow:
On ubuntu-master:
transport.host: ubuntu-master
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0

discovery.seed_hosts: ["ubuntu-master", "ubuntu-dev2"]

On ubuntu-dev2:
transport.host: ubuntu-dev2
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0
discovery.seed_hosts: ["ubuntu-master", "ubuntu-dev2"]

We can see the nodes after that
>GET /_cat/nodes?v
ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.56.3              7          86   0    0.19    0.24     0.10 mdi       -      elastic2
192.168.56.101           33          45   1    0.27    0.25     0.16 mdi       *      elastic1

Similar to all the configurations, we can add another node as we want.
ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.56.3             13          87   0    0.00    0.05     0.06 mdi       -      elastic2
192.168.56.103            9          96  30    0.39    0.10     0.03 mdi       -      elastic3
192.168.56.101           11          45   0    0.08    0.09     0.11 mdi       *      elastic1

Once the cluster is ready, we can access the data like this
http://ubuntu-dev4:9200/customer/_doc/1?pretty
{"_index": "customer","_type": "_doc","_id": "1","_version": 3,"_seq_no": 4,"_primary_term": 1,"found": true,"_source": {"name": "Karl Luo","gender": "male"}}


References:
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-install.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-create-index.html
http://kael-aiur.com/elk/ES%E9%85%8D%E7%BD%AE%E7%BB%99%E5%A4%96%E9%83%A8%E6%9C%BA%E5%99%A8%E9%80%9A%E8%BF%87ip%E8%AE%BF%E9%97%AE.html

分享到:
评论

相关推荐

    ES查询客户端,elasticsearch可视化工具 elasticsearch查询客户端

    Elasticsearch(简称ES)是一款强大的开源搜索引擎,广泛应用于数据检索、分析和管理。作为分布式、RESTful风格的搜索和数据分析引擎,Elasticsearch能够提供实时、高可用性以及可扩展的搜索功能。在进行日常的数据...

    es-head Elasticsearch的可视化操作插件

    es-head是一个针对Elasticsearch的可视化操作插件。它提供了一个便捷的操作工具,可以连接Elasticsearch...4.连接 Elasticsearch。在 es-head 插件页面输入连接地址 ip 和端口号后点链接即可。连接后显示绿色代表健康。

    (狂神)ElasticSearch快速入门笔记,ElasticSearch基本操作以及爬虫(Java-ES仿京东实战)

    (狂神)ElasticSearch快速入门笔记,ElasticSearch基本操作以及爬虫(Java-ES仿京东实战),包含了小狂神讲的东西,特别适合新手学习,笔记保存下来可以多看看。好记性不如烂笔头哦~,ElasticSearch,简称es,es是一个...

    ES客户端+谷歌浏览器插件+Multi-Elasticsearch-Head

    多弹性搜索头,对著名的 Elasticsearch Head 的改进 1.保存和存储几个Elasticsearch端点 2.索引选项卡中的更多列 3. 任何请求现在都可以像 /_cat/indices 一样处理 JSON 返回 4. 更简约的外观(更小的字体等...) ...

    Elastic Search搭建使用教程.pdf(内含ElasticSearch教程权威指南)

    Cluster是由多个Node组成的,每个Cluster都有一个唯一的集群名称,默认为"elasticsearch"。Index是Elasticsearch中管理数据的顶层单位,相当于数据库中的表,数据以JSON格式存储在Document中。Document是Index中的单...

    elasticSearch(ES)最新版 ik分词插件7.10 elasticsearch-analysis-ik-7.10.0

    Elasticsearch(ES)是一种流行的开源全文搜索引擎,它基于Lucene构建,提供了分布式、RESTful风格的搜索和分析引擎服务。在中文环境下,为了实现精确的分词和搜索,我们需要安装适合版本的分词插件,如“elastic...

    elasticsearch 8.11.3 windows安装包

    Elasticsearch 是位于 Elastic Stack 核心的分布式搜索和分析引擎。Logstash 和 Beats 有助于收集、聚合和丰富您的数据并将其存储在 Elasticsearch 中。Kibana 使您能够以交互方式探索、可视化和分享对数据的见解,...

    最新版linux elasticsearch-7.13.4-linux-x86_64.tar.gz

    3. 停止Elasticsearch:`/usr/local/elasticsearch/elasticsearch-7.13.4/bin/elasticsearch-stop` 安全性和权限: - Elasticsearch 7.x版本开始,默认启用了安全功能,需要设置用户和角色。可以通过Kibana的...

    elasticsearch服务器安装包

    4. **配置文件**:Elasticsearch的主要配置文件是`elasticsearch.yml`,位于解压后的`config`目录下。你可以根据需求修改集群名称、节点角色、索引分片数量等参数。 5. **启动Elasticsearch**:在解压后的目录下,...

    es docker 部署 elasticsearch.yml

    docker run --name elasticsearch7.16.3 -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" -v /Users/xingyue/Home/xingyue/学习/工程化/es/elasticsearch.yml:/usr/share/elastic...

    elasticsearch elasticsearch-6.2.2 elasticsearch-6.2.2.zip 下载

    根据提供的文件信息,我们可以推断出本篇文章将围绕Elasticsearch 6.2.2版本进行详细介绍,包括其下载方式、主要功能特性以及在实际应用中的常见用途。 ### Elasticsearch简介 Elasticsearch是一款基于Lucene的...

    ElasticSearch官方测试数据

    Elasticsearch(ES)是一种流行的开源全文搜索引擎,它基于Lucene库构建,被广泛用于大数据分析、日志聚合、实时搜索和索引等场景。官方提供的测试数据集是检验Elasticsearch功能、性能和稳定性的关键资源,可以帮助...

    springboot整合es-springboot-elasticsearch.zip

    4. **实体类注解**:为需要存储到Elasticsearch的实体类添加`@Document`注解,并指定索引名称。 ```java @Document(indexName = "users") public class User { @Id private Long id; private String username; ...

    elasticSearch-8.14.1-windows

    - **单节点配置**:在`elasticsearch.yml`中,可以设置`cluster.name`以定义集群名称,保持所有节点的集群名称一致,它们就会自动加入同一集群。 - **内存设置**:根据你的系统资源调整`jvm.options`中的堆大小。...

    7.17.1系列Elasticsearch的elasticsearch-analysis-ik分词器

    适用于7.17.1系列,例如Elasticsearch的7.17.12版本。 elasticsearch-analysis-ik 是一个常用的中文分词器,在 Elasticsearch 中广泛应用于中文文本的分析和搜索。下面是 elasticsearch-analysis-ik 分词器的几个...

    Elasticsearch 开机自启脚本

    `start` 用于启动Elasticsearch,这里使用 `su` 命令切换到指定的Elasticsearch用户(例如 `es-admin`),然后进入Elasticsearch的安装目录并执行 `bin/elasticsearch` 文件以后台模式启动服务。`stop` 通过查找并杀...

    《ElasticSearch入门到实战》电子书,从入门到进阶实战项目的教程文档,框架SpringBoot框架整合ES.zip

    4. **聚合分析**:学习如何使用 Elasticsearch 的聚合功能进行数据统计和分析,如术语聚合、范围聚合、统计聚合等。 5. **映射与分析**:了解字段映射的重要性,以及如何设置分析器进行文本分词,以满足不同的搜索...

    基于.netcore搜索封装ElasticSearch.zip

    这个名为"基于.netcore搜索封装ElasticSearch.zip"的压缩包,显然包含了一个针对.NET Core平台的Elasticsearch客户端库,方便开发者在.NET Core应用中集成和操作Elasticsearch。 Elasticsearch是一个开源的分布式...

    elasticsearch-7.4.0-win64.rar

    Elasticsearch是一个开源的全文搜索引擎,它以分布式、RESTful服务的方式提供快速、高可用、可扩展的数据搜索和分析能力。这个"elasticsearch-7.4.0-win64.rar"压缩包包含了Elasticsearch 7.4.0版本的Windows 64位...

    解决spring-data-elasticsearch 5.4.0 不支持 5.4.1的elasticsearch问题

    4. **使用兼容模式**:某些情况下,Elasticsearch可能会提供一种向后兼容的模式,允许旧版本的客户端连接新版本的服务器。检查Elasticsearch的配置文档以获取相关信息。 5. **查阅官方文档**:Spring Data Elastic...

Global site tag (gtag.js) - Google Analytics