In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Source code of this article: GitHub click here | | GitEE click here |
A brief introduction to 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.
Second, middleware installation 1, installation environment and version Centos7JDK1.8elasticsearch-6.3.22, 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.zip3, startup 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 _ force Elastic 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.06, install IK Chinese word splitter
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. Getting started
Index creation and deletion
1. Create index [esroot@localhost ~] $curl-X PUT 'localhost:9200/esindex01'# return 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.
Source code address GitHub address https://github.com/cicadasmile/linux-system-baseGitEE address https://gitee.com/cicadasmile/linux-system-base
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: 228
*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
Add nameserver 8.8.8.8 at the end of the / etc/resolv.conf file.
© 2024 shulou.com SLNews company. All rights reserved.