Last active
July 18, 2021 09:46
-
-
Save jasonwee/a0540fa1bf1dc50023bd32b77a9a3413 to your computer and use it in GitHub Desktop.
elasticsearch on rpi4 8gb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jason@localhost:~ $ cat /etc/*release | |
PRETTY_NAME="Debian GNU/Linux 10 (buster)" | |
NAME="Debian GNU/Linux" | |
VERSION_ID="10" | |
VERSION="10 (buster)" | |
VERSION_CODENAME=buster | |
ID=debian | |
HOME_URL="https://www.debian.org/" | |
SUPPORT_URL="https://www.debian.org/support" | |
BUG_REPORT_URL="https://bugs.debian.org/" | |
jason@localhost:~ $ uname -a | |
Linux localhost 5.10.17-v8+ #1421 SMP PREEMPT Thu May 27 14:01:37 BST 2021 aarch64 GNU/Linux | |
jason@localhost:~ $ arch | |
aarch64 | |
jason@localhost:~ $ | |
jason@localhost:~ $ free -m | |
total used free shared buff/cache available | |
Mem: 7813 160 6924 40 728 7502 | |
Swap: 99 0 99 | |
jason@localhost:~ $ lscpu | |
Architecture: aarch64 | |
Byte Order: Little Endian | |
CPU(s): 4 | |
On-line CPU(s) list: 0-3 | |
Thread(s) per core: 1 | |
Core(s) per socket: 4 | |
Socket(s): 1 | |
Vendor ID: ARM | |
Model: 3 | |
Model name: Cortex-A72 | |
Stepping: r0p3 | |
CPU max MHz: 1500.0000 | |
CPU min MHz: 600.0000 | |
BogoMIPS: 108.00 | |
Flags: fp asimd evtstrm crc32 cpuid | |
jason@localhost:~ $ | |
-------------- | |
jason@localhost:~ $ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-linux-aarch64.tar.gz | |
--2021-07-18 11:06:09-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-linux-aarch64.tar.gz | |
Resolving artifacts.elastic.co (artifacts.elastic.co)... 2600:1901:0:1d7::, 34.120.127.130 | |
Connecting to artifacts.elastic.co (artifacts.elastic.co)|2600:1901:0:1d7::|:443... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 324263085 (309M) [application/x-gzip] | |
Saving to: ‘elasticsearch-7.13.3-linux-aarch64.tar.gz’ | |
elasticsearch-7.13.3-linux-aarch64.tar.gz 100%[=====================================================================================================>] 309.24M 1.81MB/s in 60s | |
2021-07-18 11:07:10 (5.13 MB/s) - ‘elasticsearch-7.13.3-linux-aarch64.tar.gz’ saved [324263085/324263085] | |
jason@localhost:~ $ | |
jason@localhost:~ $ md5sum elasticsearch-7.13.3-linux-aarch64.tar.gz | |
8432becbe5f8d259c219173bd69768aa elasticsearch-7.13.3-linux-aarch64.tar.gz | |
jason@localhost:~ $ | |
------ | |
not enough space on microsd card, create a tmpfs | |
# mkdir /elasticsearch/ | |
# chown jason.jason /elasticsearch/ | |
# mount -F tmpfs -o size=1g swap /elasticsearch | |
# mount -t tmpfs -o size=1g tmpfs /elasticsearch | |
# mount -v | grep elastic | |
------ | |
jason@localhost:~ $ cp elasticsearch-7.13.3-linux-aarch64.tar.gz /elasticsearch/ | |
jason@localhost:~ $ cd /elasticsearch/ | |
jason@localhost:/elasticsearch $ ls | |
elasticsearch-7.13.3-linux-aarch64.tar.gz | |
jason@localhost:/elasticsearch $ tar -zxf elasticsearch-7.13.3-linux-aarch64.tar.gz | |
jason@localhost:/elasticsearch $ ls | |
elasticsearch-7.13.3 elasticsearch-7.13.3-linux-aarch64.tar.gz | |
jason@localhost:/elasticsearch $ cd elasticsearch-7.13.3/ | |
jason@localhost:/elasticsearch/elasticsearch-7.13.3 $ cd bin/ | |
jason@localhost:/elasticsearch/elasticsearch-7.13.3/bin $ ls | |
elasticsearch elasticsearch-croneval elasticsearch-keystore elasticsearch-saml-metadata elasticsearch-sql-cli x-pack-env | |
elasticsearch-certgen elasticsearch-env elasticsearch-migrate elasticsearch-service-tokens elasticsearch-sql-cli-7.13.3.jar x-pack-security-env | |
elasticsearch-certutil elasticsearch-env-from-file elasticsearch-node elasticsearch-setup-passwords elasticsearch-syskeygen x-pack-watcher-env | |
elasticsearch-cli elasticsearch-geoip elasticsearch-plugin elasticsearch-shard elasticsearch-users | |
jason@localhost:/elasticsearch/elasticsearch-7.13.3/bin $ ./elasticsearch -V | |
Version: 7.13.3, Build: default/tar/5d21bea28db1e89ecc1f66311ebdec9dc3aa7d64/2021-07-02T12:06:10.804015202Z, JVM: 16 | |
jason@localhost:/elasticsearch/elasticsearch-7.13.3/bin $ | |
---- | |
start es and check cluster green | |
jason@localhost:/elasticsearch/elasticsearch-7.13.3/bin $ ./elasticsearch | |
[2021-07-18T11:31:23,482][INFO ][o.e.n.Node ] [localhost] version[7.13.3], pid[32359], build[default/tar/5d21bea28db1e89ecc1f66311ebdec9dc3aa7d64/2021-07-02T12:06:10.804015202Z], OS[Linux/5.10.17-v8+/aarch64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/16/16+36] | |
[2021-07-18T11:31:23,500][INFO ][o.e.n.Node ] [localhost] JVM home [/elasticsearch/elasticsearch-7.13.3/jdk], using bundled JDK [true] | |
[2021-07-18T11:31:23,503][INFO ][o.e.n.Node ] [localhost] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-10348294316108618707, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms3906m, -Xmx3906m, -XX:MaxDirectMemorySize=2047868928, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/elasticsearch/elasticsearch-7.13.3, -Des.path.conf=/elasticsearch/elasticsearch-7.13.3/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true] | |
[2021-07-18T11:31:34,636][INFO ][o.e.p.PluginsService ] [localhost] loaded module [aggs-matrix-stats] | |
[2021-07-18T11:31:34,638][INFO ][o.e.p.PluginsService ] [localhost] loaded module [analysis-common] | |
[2021-07-18T11:31:34,640][INFO ][o.e.p.PluginsService ] [localhost] loaded module [constant-keyword] | |
[2021-07-18T11:31:34,641][INFO ][o.e.p.PluginsService ] [localhost] loaded module [frozen-indices] | |
[2021-07-18T11:31:34,642][INFO ][o.e.p.PluginsService ] [localhost] loaded module [ingest-common] | |
[2021-07-18T11:31:34,644][INFO ][o.e.p.PluginsService ] [localhost] loaded module [ingest-geoip] | |
[2021-07-18T11:31:34,645][INFO ][o.e.p.PluginsService ] [localhost] loaded module [ingest-user-agent] | |
[2021-07-18T11:31:34,646][INFO ][o.e.p.PluginsService ] [localhost] loaded module [kibana] | |
jason@localhost:~ $ curl -XGET 'http://localhost:9200/_cluster/health?pretty=true' | |
{ | |
"cluster_name" : "elasticsearch", | |
"status" : "green", | |
"timed_out" : false, | |
"number_of_nodes" : 1, | |
"number_of_data_nodes" : 1, | |
"active_primary_shards" : 0, | |
"active_shards" : 0, | |
"relocating_shards" : 0, | |
"initializing_shards" : 0, | |
"unassigned_shards" : 0, | |
"delayed_unassigned_shards" : 0, | |
"number_of_pending_tasks" : 0, | |
"number_of_in_flight_fetch" : 0, | |
"task_max_waiting_in_queue_millis" : 0, | |
"active_shards_percent_as_number" : 100.0 | |
} | |
jason@localhost:~ $ | |
---- | |
index it | |
jason@localhost:~ $ curl -X POST "localhost:9200/monitoring/sensor?pretty" -H 'Content-Type: application/json' -d' | |
> { | |
> "id":"00:11:22:33:44:55", | |
> "sensor_1": 11, | |
> "sensor_2": 22, | |
> "sensor_3": 33.5, | |
> "timestamp": "2021-07-18T09:43:50+02:00" | |
> } | |
> ' | |
{ | |
"_index" : "monitoring", | |
"_type" : "sensor", | |
"_id" : "kooAuXoBgTxDmFgQsPpy", | |
"_version" : 1, | |
"result" : "created", | |
"_shards" : { | |
"total" : 2, | |
"successful" : 1, | |
"failed" : 0 | |
}, | |
"_seq_no" : 0, | |
"_primary_term" : 1 | |
} | |
jason@localhost:~ $ | |
query it | |
jason@localhost:~ $ curl -X GET "localhost:9200/monitoring/_search?pretty" -H 'Content-Type: application/json' -d' | |
> { | |
> "query": { | |
> "match_all": { } | |
> } | |
> } | |
> ' | |
{ | |
"took" : 240, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 1, | |
"successful" : 1, | |
"skipped" : 0, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : { | |
"value" : 1, | |
"relation" : "eq" | |
}, | |
"max_score" : 1.0, | |
"hits" : [ | |
{ | |
"_index" : "monitoring", | |
"_type" : "sensor", | |
"_id" : "kooAuXoBgTxDmFgQsPpy", | |
"_score" : 1.0, | |
"_source" : { | |
"id" : "00:11:22:33:44:55", | |
"sensor_1" : 11, | |
"sensor_2" : 22, | |
"sensor_3" : 33.5, | |
"timestamp" : "2021-07-18T09:43:50+02:00" | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment