Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Elasticsearch cluster to build 1Welcome to my ELK world!

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

System environment:

Jdk1.8 environment

Ubuntu16.04 system 172.20.1.10 node-1

Ubuntu16.04 system 172.20.1.20 node-2

Ubuntu16.0.4 system 172.20.1.30 node-3

Install elasticsearch version: elasticsearch-6.2.2.tar.gz

Download path of the installation package (with 6.2.2, 6.4.2 and jdk1.8 packages):

Https://pan.baidu.com/s/1bTBb6n27wcunwAFCRB5yNQ password: 8raw

1. Install elasticsearch reference: http://www.cnblogs.com/hanyinglong/p/5409003.html

Tell me about my own practice.

Take a look at your java environment and replace it with jdk1.8, which has a lot of reference documents online.

To say something here, it is to extract the package and then configure the environment variables.

The path is specified according to the location of your own decompression. Finally, source / etc/profile

Mkdir-p / data/software/elasticsearch

Create a user because you cannot use a root user to start es.

Sudo adduser es

Then hit Y and finish it.

Cd / home/ to see if there is a home directory.

Then go to the download package storage path to extract the package.

Sudo tar-zxvf elasticsearch-2.3.1.tar.gz

Sudo mv elasticsearch-2.3.1 / data/software/elasticsearch

Sudo chown-R es.es / data/software/elasticsearch

Let's look at the file structure of es:

We do an es on each machine, which is neither a suggestion nor a rule of thumb, because you are the scapegoat of the operation and maintenance staff, so you should pay attention to the fact that if the machine goes down, the data will be gone. The most common security practice for rookies is to make only one node on each of the three machines (this practice allows and only allows any server to go down). If you don't understand why es does this, please read my technical note.

Next we modify the configuration file for elasticsearch.

After the modification is completed, we switch to the es user to start es, remember: switch to the es user! Switch to es user! Switch to es user!

Otherwise, the following will happen:

But you may encounter the following situation , don't panic: basic operation.

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Modify several configuration files:

/ etc/profile file is added at the end: ulimit-SHn 65536

/ etc/security/limits.conf file is added at the end:

Soft nofile 65536hard nofile 65536soft nproc 4096hard nproc 4096

Then we apply these configurations to es users can take a look at ulimit-Hn

We'll start it when everything's all right.

We visit ip:9200 on the web page and come up with the following content to show our success.

The other 2 nodes have finished normal operation according to the above operation (delete the data under the / data/software/elasticsearch/data/ node directory before starting a possible problem). Congratulations on your success as shown in the figure above.

The next step is to install the troublesome and low elasticsearch-head, which can also be operated by everyone. (in the production environment, you can try not to use the head plug-in as far as possible, because the security is very poor, and others can use your es to operate on the node.)

After elasticsearch 5.x, direct plugin installation of head plug-ins is not supported. Instead, head is installed as a separate service. The dependent node,npm,grunt needs to be installed first.

Apt-get install npm

Apt-get install nodejs-legacy

Npm install-g grunt

Npm install-g grunt-cli

Download elasticsearch-head, I extract it to the directory / data/software/elasticsearch-head, and change the directory user to es

Then modify the configuration

1. Modify the connection address elasticsearch-head/_site/app.js of head

This.base_uri = this.config.base_uri | | this.prefs.get ("app-base_uri") | | "http://localhost:9200";"

Localhost changed to its own ip.

two。 Modify the listening address elasticsearch-head/Gruntfile.js of the server

Connect: {server: {options: {port: 9100, base:'., keepalive: true}

Add hostname to options:'*'

3. Modify the elasticseach configuration file elasticsearch.yml, modify the corresponding ip and cross-domain settings, and add:

Http.cors.enabled: true

Http.cors.allow-origin: "*"

3 run under elasticsearch-head: grunt server

3.1But there will be an error prompt (when the command typed npm start, it should be the same):

Root@ubuntu:/usr/local/kencery/elasticsearch-head# npm start

Elasticsearch-head@0.0.0 start / usr/local/kencery/elasticsearch-head

Grunt server

Grunt-cli: The grunt command line interface (v1.2.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to

Your project. For more information about installing and configuring grunt

Please see the Getting Started guide:

Http://gruntjs.com/getting-started

Npm ERR! Linux 4.4.0-62-generic

Npm ERR! Argv "/ usr/bin/nodejs"/ usr/bin/npm"start"

Npm ERR! Node v4.2.6

Npm ERR! Npm v3.5.2

Npm ERR! Code ELIFECYCLE

Npm ERR! Elasticsearch-head@0.0.0 start: grunt server

Npm ERR! Exit status 99

Npm ERR!

Npm ERR! Failed at the elasticsearch-head@0.0.0 start script 'grunt server'.

Npm ERR! Make sure you have the latest version of node.js and npm installed.

Npm ERR! If you do, this is most likely a problem with the elasticsearch-head package

Npm ERR! Not with npm itself.

Npm ERR! Tell the author that this fails on your system:

Npm ERR! Grunt server

Npm ERR! You can get information on how to open an issue for this project with:

Npm ERR! Npm bugs elasticsearch-head

Npm ERR! Or if that isn't available, you can get their info via:

Npm ERR! Npm owner ls elasticsearch-head

Npm ERR! There is likely additional logging output above.

Npm ERR! Please include the following file with any support request:

Npm ERR! / usr/local/kencery/elasticsearch-head/npm-debug.log

The hint probably mentioned that the version is not the latest problem, so have a try to upgrade npm and node

Npm cache clean-f

Npm install-g n

N stable

Npm install npm@latest-g

If you look at the next version, you will see

Elasticsearch@ubuntu:~$ node-v

V10.4.0

Elasticsearch@ubuntu:~$ npm-v

6.1.0

3.2But running grunt server still reports an error:

Grunt hasn't been installed locally to your project

Referring to https://segmentfault.com/q/1010000004172559/a-1020000004193932, execute:

Npm install grunt-save-dev

3.3 run it again and still report an error:

Elasticsearch@ubuntu:/usr/local/kencery/elasticsearch-head$ grunt server

Local Npm module "grunt-contrib-clean" not found. Is it installed?

Local Npm module "grunt-contrib-concat" not found. Is it installed?

Local Npm module "grunt-contrib-watch" not found. Is it installed?

Local Npm module "grunt-contrib-connect" not found. Is it installed?

Local Npm module "grunt-contrib-copy" not found. Is it installed?

Local Npm module "grunt-contrib-jasmine" not found. Is it installed?

Warning: Task "connect:server" not found. Use-- force to continue.

Then I simply installed all the latest ones about grunt:

Npm install grunt@latest

Npm install grunt-cli@latest

Npm install grunt-contrib-copy@latest

Npm install grunt-contrib-concat@latest

Npm install grunt-contrib-uglify@latest

Npm install grunt-contrib-clean@latest

Npm install grunt-contrib-watch@latest

Npm install grunt-contrib-connect@latest

Npm install grunt-contrib-jasmine@latest

4.4 finally grunt server is ready to start:

Elasticsearch@ubuntu:/usr/local/kencery/elasticsearch-head$ grunt server

(node:1527) ExperimentalWarning: The http2 module is an experimental API.

Running "connect:server" (connect) task

Waiting forever...

Started connect web server on http://localhost:9100

You can see that the port of the elasticsearch service is 9200 and the port of the head plug-in service is 9100. We access the head and then head the elasticsearch.

Reference documentation:

1 https://blog.csdn.net/shm839218753/article/details/80618073

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report