In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "building ElasticSearch middleware and common interface instance analysis under centos7". In the operation of actual cases, many people will encounter this dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. brief introduction of middleware
1. Basic concepts
Elasticsearch is a lucene-based search server. It provides a full-text search engine with distributed multi-user capability, based on restful web interface. Elasticsearch is developed in java and released as open source under the apache license terms, and is currently a popular enterprise search engine.
2. Distributed database
Distributed database systems usually use smaller computer systems, each computer can be placed in a separate place, each computer may have a complete copy of dbms, or a partial copy, and has its own local database. Many computers located in different locations are connected to each other through the network to form a complete, global logically centralized, physically distributed large database.
3. Core role
1) nodes and clusters
Cluster represents a cluster, and there are multiple nodes in the cluster, including a master node, which can be elected, and the master and slave nodes are internal to the cluster. One of the concepts of es is decentralization, which literally means no central node, which is external to the cluster, because from the external point of view, the es cluster is logically a whole. A single elastic instance is called a node. A group of nodes forms a cluster.
2) shards fragmentation
On behalf of index shards, es can divide a complete index into multiple shards, which has the advantage of splitting a large index into multiple nodes. Constitute a distributed search. The number of fragments can only be specified before the index is created, and cannot be changed after the index is created.
3) document documents
A single record in index is called document (document). Many document make up an index. Document is represented in json format.
4) index Index
Elastic indexes all fields, and when looking for data, it looks for the index directly. The name of each index (that is, understood as the database name) must be lowercase.
5) type type
Document can perform virtual logical grouping according to type to filter document, which is understood as the name of the database table.
2. Installation of middleware
1. Installation environment and version
Centos7
Jdk1.8
Elasticsearch-6.3.2
2. Download and decompress
Download path, under the folder of the current directory, you can also specify the download path. Wget-p directory URL.
Wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip[root@localhost roo] # mv elasticsearch-6.3.2.zip / usr/local/mysoft/ [root@localhost mysoft] # unzip elasticsearch-6.3.2.zip
3. Start the software
[root@localhost mysoft] # cd elasticsearch-6.3.2/ [root@localhost elasticsearch-6.3.2] #. / bin/elasticsearch
1) wrong number one
Org.elasticsearch.bootstrap.startupexception: java.lang.runtimeexception: can not run elasticsearch as root
New user groups and users
[root@localhost] # useradd esroot [root@localhost] # passwd esroot [root@localhost] # groupadd esgroup [root@localhost] # usermod-g esgroup esroot
Esroot user Authorization
Chown esroot / usr/local/mysoft/elasticsearch-6.3.2-r
Switch to esroot user
[root@localhost mysoft] # su-esroot [esroot@localhost ~] $su # back to root users
2) error 2
Max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
Perform the following naming, which operates under root authority.
[root@localhost roo] # vim / etc/security/limits.conf
Add content
* soft nofile 65536 * hard nofile 65536
Switch back to esroot user
Start again and there is no error message.
4. Open the command line test
Curl localhost:9200 [roo@localhost ~] $curl localhost:9200 {"name": "yms44oi", "cluster_name": "elasticsearch", "cluster_uuid": "2zxjbnkjsjiev_k1iwmzrq", "version": {"number": "6.3.2", "build_flavor": "default", "build_type": "zip", "build_hash": "053779d" "build_date": "2018-07-20t05:20:23.451332z", "build_snapshot": false, "lucene_version": "7.3.1", "minimum_wire_compatibility_version": "5.6.0", "minimum_index_compatibility_version": "5.0.0"}, "tagline": "you know, for search"}
In this way, the elasticsearch-6.3.2 environment is successfully built.
When port 9200 is requested, elastic returns a json object containing the current node, cluster, version, and other information.
Press ctrl + c _ clock and it will stop running.
5. Configure external access
By default, elastic only allows local access, and if you need remote access, you can modify the config/elasticsearch.yml file in the elastic installation directory, uncomment network.host, change its value to 0.0.0.0, and then restart elastic.
[esroot@localhost config] $cd / usr/local/mysoft/elasticsearch-6.3.2/config [esroot@localhost config] $vim elasticsearch.yml network.host: 0.0.0.0
6. Install ik Chinese word Separator
Switch to root user
[root@localhost elasticsearch-6.3.2] $. / bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.2/elasticsearch-analysis-ik-6.3.2.zip
III. Entry operation
Index creation and deletion
1. Create an index
[esroot@localhost ~] $curl-x put 'localhost:9200/esindex01'# returns data {"acknowledged": true, "shards_acknowledged": true, "index": "esindex01"}
The server returns a json object, and the acknowledged:true field indicates that the operation was successful.
2. Delete the index
[esroot@localhost ~] $curl-x delete 'localhost:9200/esindex01' {"acknowledged": true}
The acknowledged:true field indicates a successful operation.
This is the end of the content of "Building ElasticSearch Middleware and Analysis of Common Interface examples under centos7". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.