-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelasticsearch.txt
147 lines (128 loc) · 4.14 KB
/
elasticsearch.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
chmod a+x curl
ls -al
chmod 777
chmod 777 curl
source .profile
echo $PATH
which curl
curl -XGET 127.0.0.1:9200
history -c
wget http://media.sundog-soft.com/es7/movies.json
wc -l movies.json
size
du -h directory/
ls -al file/
nano curl
- #!/bin/bash
- /usr/bin/curl -H "Content-Type: application/json" "$@"
CURL
curl -XGET 127.0.0.1:9200/movies/_mapping?pretty
curl -XGET 127.0.0.1:9200/movies/_mapping
curl -XGET 127.0.0.1:9200/movies/_mapping?pretty
curl -XGET 127.0.0.1:9200/movies/_search?pretty
curl -XPOST 127.0.0.1:9200/movies/_doc/1 -d '
{
"genre":["IMAX","Sci-Fi"],
"title":"interstellarş",
"year":2014
}'
curl -XPUT 127.0.0.1:9200/_bulk?pretty --data-binary @movies.json
curl -XGET 127.0.0.1:9200
curl -XGET 127.0.0.1:9200/movies/_search?pretty
curl -XPUT 127.0.0.1:9200/_bulk?pretty --data-binary @movies.json
curl -XPUT 127.0.0.1:9200/movies/_bulk?pretty --data-binary @movies.json
curl -XDELETE 127.0.0.1:9200/movies
Elasticsearch
sudo apt-get install elasticsearch
sudo systemctl status elasticsearch.service
- elastic durum kontrol
sudo more /etc/elasticsearch/elasticsearch.yml
-
sudo /bin/systemctl daemon-reload
- servisleri ekler
sudo /bin/systemctl enable elasticsearch.service
- servisi servislere ekler
sudo /bin/systemctl start elasticsearch.service
- servis başlat
sudo more /etc/elasticsearch/jvm.options
- Elasticsearch system dosyalarının bulunduğu dizin
sudo nano /etc/elasticsearch/jvm.options
sudo systemctl stop elasticsearch.service
sudo systemctl start elasticsearch.service
curl -XGET localhost:9200/_cluster/health?pretty
cd /usr/share/elasticsearch
- Elasticsearch programının yüklendiği yer
sudo bin/elasticsearch-sql-cli
- sql komutlarının çalıştırıldığı yer
Kibana
sudo apt-get install kibana
sudo systemctl daemon-reload
sudo systemctl enable kibana.service
sudo systemctl start kibana.service
systemctl status kibana.service
match
- kelime eşleştirme
match_phrase
- cümle eşleştirme
GET /shakespeare/_search
{
"query": {
"match_phrase": {
"text_entry": "to be or not to be"
}
}
}
PUT /movies
{
"mappings": {
"properties": {
"year":{
"type": "date"
}
}
}
}
POST movies/_doc/200000
{
"genre":"komedi",
"title":"Şaban Askerde",
"year":1970
}
POST movies/_doc/200000
{
"genre":"komedi",
"title":"Şaban Askerde",
"year":1970,
"oyuncu":"Kemal Sunal"
}
Çoklu Node Kurulumu
/etc/elasticsearch/elasticsearch.yml
sudo nano /etc/elasticsearch/elasticsearch.yml
node.max_local_storage_nodes: 3
cluster.name: garip
node.name: node-1
Not: discovery.zen.ping.unicast.hosts:["144.12.12.14","144.12.12.2"] Farklı sunucularda kesinlikle tüm ip leri olmalı
cluster.initial_master_nodes: ["node-1","node-2","node-3"]
cd /etc
sudo cp -rp elasticsearch elasticsearch-node2
sudo cp -rp elasticsearch elasticsearch-node3
sudo nano /etc/elasticsearch-node2/elasticsearch.yml
node.name: node-2
Not: discovery.zen.ping.unicast.hosts:["144.12.12.14","144.12.12.2"] Farklı sunucularda kesinlikle tüm ip leri olmalı
Not: http:port: 9201 -- productionda farklı sunucular olduğu için ip değiştirmeye gerek yok
sudo nano elasticsearch-node3/elasticsearch.yml
node.name: node-3
Not: discovery.zen.ping.unicast.hosts:["144.12.12.14","144.12.12.2"] Farklı sunucularda kesinlikle tüm ip leri olmalı
Not: http:port: 9202 -- productionda farklı sunucular olduğu için ip değiştirmeye gerek yok
cd /usr/lib/systemd/system
sudo cp elasticsearch.service elasticsearch-node2.service
sudo cp elasticsearch.service elasticsearch-node2.service
sudo nano elasticsearch-node2.service
Environment=ES_PATH_CONF=/etc/elasticsearch-node2
sudo nano elasticsearch-node3.service
Environment=ES_PATH_CONF=/etc/elasticsearch-node3
sudo systemctl daemon-reload
sudo systemctl stop elasticsearch.service
sudo systemctl start elasticsearch.service
sudo systemctl start elasticsearch-node2.service
sudo systemctl start elasticsearch-node3.service