5

How to install elastic search in local system and live server

 1 year ago
source link: https://www.laravelcode.com/post/how-to-install-elastic-search-in-local-system-and-live-server
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to install elastic search in local system and live server

  9889 views

  5 years ago

Elasticsearch

Laravelcode write one of the very helpfull article related how to install or configure elastic search in your local system as well as in live server.

Elastic search is a search engine based on Lucene. it main use in any web application for a full text search in appllication with HTTP web interface and schema-free JSON documents. elastic search is develop in java. so, if you are use elastic search then you must be install java.

So, how to install elastic search in local system? please follow this very simple step and make it easy

first we are required install java in our system like that

step : 2 Installing Java

Before installing OpenJDK with APT, update the list of available packages for installation on your Ubuntu Droplet by running the command:


$ sudo apt-get update

After that, you can install OpenJDK with the command :


$ sudo apt-get install openjdk-7-jre

To verify your JRE is installed and can be used, run the command:


$ java -version

After following jave installation finished then now we are ready to install elastic search in our system or live server like that..

step : 2 Downloading and Installing Elasticsearch :

First Download elastic serach by this command


$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb

Then install it in the usual Ubuntu way with the dpkg command like this :


$ sudo dpkg -i elasticsearch-1.7.2.deb

To make sure Elasticsearch starts and stops automatically with the Droplet, add its init script to the default runlevels with the command:


$ sudo update-rc.d elasticsearch defaults

Download elastic search is successfull in local system or live server then configure elastic search like that

step : 3 Configuring Elastic :

To start editing the main elasticsearch.yml configuration file:


$ sudo nano /etc/elasticsearch/elasticsearch.yml

Remove the # character at the beginning of the lines for node.name and cluster.name to uncomment them, and then change their values this way.


node.name: "My First Node" 
cluster.name: mycluster1

Once you make all the changes, please save and exit the file. Now you can start Elasticsearch for the first time with the command:


$ sudo service elasticsearch start

After configure elastic search then we are make Securing it this way

step : 4 Securing Elastic :

[ADDCODE]

Elasticsearch has no built-in security and can be controlled by anyone who can access the HTTP API. So, the first security tweak is to prevent public access. To remove public access edit the file elasticsearch.yml:


$ sudo nano /etc/elasticsearch/elasticsearch.yml

Find the line that contains network.bind_host, uncomment it by removing the # character at the beginning of the line, and change the value to localhost so it looks like this:


network.bind_host: localhost

To disable custom expressions, add the following line is at the end of the /etc/elasticsearch/elasticsearch.yml file:


script.disable_dynamic: true

Now we are successfully installing and configure elastic search now how to testing it. it's work properly or not like this

step : 5 Testing :

$ curl -X GET 'http://localhost:9200'

Or run


http://localhost:9200

in any browser. You should see the following response:


{
"status" : 200,
"name" : "Harry Leland",
"cluster_name" : "elasticsearch",
"version" : {
	"number" : "1.7.2",
	"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
	"build_timestamp" : "2015-09-14T09:49:53Z",
	"build_snapshot" : false,
	"lucene_version" : "4.10.4" 
	},
"tagline" : "You Know, for Search" 
}

We are hope this article is very helpfull for all....

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK