ElasticSearch, girka wannan sabar binciken akan Ubuntu

game da ElasticSearch

A talifi na gaba zamuyi bincike akan ElasticSearch. Labari ne game da cikakken rubutu uwar garken bincike bisa Lucene. A cikin wannan sakon mai sauri, zamu ga yadda za mu girka ɗayan shahararrun binciken rubutu da dandamali na ƙididdiga akan Ubuntu, kuma mu fara da shi.

Wannan sabar binciken tana ba mu rarraba, injin bincike mai cikakken rubutu tare da gidan yanar gizo. RESTful kuma tare da takardun JSON. Binciken Elastic shine ɓullo a cikin Java kuma ana sake shi azaman tushen buɗaɗɗu ƙarƙashin yanayin lasisin Apache.

ElasticSearch bayanai

Binciken Elastic yana bamu yiwuwar amfani da ɗayan rumbunan adana bayanai NoSQL mafi mashahuri cewa za mu iya amfani da shi don adanawa da bincika bayanan tushen rubutu. Ya dogara ne da fasahar keɓance Lucene kuma yana ba da damar dawo da bincike a cikin milliseconds dangane da bayanan da aka lissafa. Yana tallafawa tambayoyin bayanai ta hanyar REST API. Wannan yana nufin cewa zamu iya amfani da kira mai sauƙi na HTTP da amfani da hanyoyin HTTP kamar SAMU, POST, PUT, KASHE, da dai sauransu don samun damar bayanan.

Don shigar da Elasticsearch akan Ubuntu, dole ne mu fara shigar da Java a cikin tsarin aikin mu. Zamu iya bincika idan mun girka Java ta amfani da umarni mai zuwa a cikin tashar (Ctrl + Alt T):

java -version

Lokacin da muke aiwatar da wannan umarni, idan muka sami sakamakon da aka nuna a cikin hoton da ke tafe, zai zama saboda ba a saka Java a kwamfutarmu ba:

Binciken Java na elasticsearch

Idan wannan yanayinmu ne, za mu iya shigar da Java ta bin waɗannan labarin cewa abokin aiki ya bar a zamaninsa a cikin wannan rukunin yanar gizon ko amfani da waɗannan umarnin a cikin tasharmu (Ctrl + Alt + T):

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-java8-installer

Da zarar waɗannan dokokin sun gudana, zamu iya sake tabbatar da cewa yanzu an saka Java ta amfani da umarnin da muka gwada a baya.

Shigar da ElasticSearch

Yanzu, Shigarwa ElasticSearch lamari ne na 'yan umarni kadan. Don farawa za mu zazzage ElasticSearch .deb kunshin daga shafin yanar gizo. A cikin m (Ctrl + Alt + T) kawai zamu rubuta umarnin mai zuwa:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.deb

Lokacin da muke aiwatar da umarnin da ke sama, zamu ga sakamako kamar haka:

Zazzage bayanan binciken kwaskwarima

Da zarar an gama saukarwa, za mu iya shigar da fayil ɗin ta amfani da umarnin dpkg:

elasticsearch shigarwa

sudo dpkg -i elasticsearch-1.7.2.deb

da fayilolin sanyi don ElasticSearch za a adana shi a cikin hanya / sauransu / binciken bincike. Don tabbatar da farawa da tsayawa tare da injin, gudanar da umarnin mai zuwa:

sudo update-rc.d elasticsearch defaults

Kafa ElasticSearch

A wannan lokacin mun riga mun sami aikin shigarwa na Elasticsearch. Don amfani dashi da kyau, zamu iya yin wasu manyan canje-canje ga saitunan. Gudun umarni mai zuwa zuwa Bude fayil din sanyi mai ba da rahoto:

sudo nano /etc/elasticsearch/elasticsearch.yml

A cikin fayil ɗin zamu gyara node.name da cluster.name a cikin elasticsearch.yml fayil. Ka tuna cire # a gaban kowane layi da muke son gyara don cire alamar shi azaman tsokaci.

Saitin Elasticsearch

Da zarar mun gama gyare-gyaren za mu adana fayilolin kuma mu dawo zuwa tashar. Yanzu ne lokacin zuwa fara sabar ElasticSearch a karon farko. Saboda wannan mun rubuta a cikin m:

sudo service elasticsearch start

Lokacin da aka riga an fara sabar za mu tabbatar da matsayin sabis ɗin buga a m:

matsayin elasticsearch

Amfani da ElasticSearch

Yanzu da ElasticSearch ya fara aiki akan kwamfutarmu, zamu iya fara amfani da shi. Domin duba misali cikakkun bayanai da bayanan tari, gudanar da umarnin mai zuwa:

curl SAMU bincike na roba

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

Kuna iya yin hakan shigar curl. Don yin haka, yi amfani da umarni mai zuwa:

sudo apt install curl

Yanzu, zamu iya gwadawa saka wasu bayanai a cikin binciken Elastic ta amfani da umarni mai zuwa:

curl -X POST 'http://localhost:9200/entreunosyceros/hola/1' -H 'Content-Type: application/json' -d '{ "name" : "entreunosyceros" }'

Lokacin da muke gudanar da wannan umarnin, zamu sami fitarwa mai zuwa:

POST ElasticSearch

Shigar da bayanai, za mu gwada samu wadanda muka saka yanzur:

curl -X GET 'http://localhost:9200/entreunosyceros/hola/1'

Lokacin da muke gudanar da wannan umarnin, zamu sami fitarwa mai zuwa:

Nemi Na'urar Nemi

A cikin wannan sakon kawai ina kokarin nuna yadda za mu iya shigar da ElasticSearch da gudanar da tambayoyi na asali a kai, amma yana da damar da yawa da za mu iya gano da kanmu ko a kan takaddun hukuma.


Bar tsokaci

Your email address ba za a buga. Bukata filayen suna alama da *

*

*

  1. Wanda ke da alhakin bayanan: Miguel Ángel Gatón
  2. Manufar bayanan: Sarrafa SPAM, sarrafa sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.