[๐ŸŒŽelasticsearch] Elasticsearch ์„ค์น˜ํ•˜๊ธฐ (Ubuntu 20.04)

Park Ji Youngยท2021๋…„ 1์›” 13์ผ
0

elasticsearch

๋ชฉ๋ก ๋ณด๊ธฐ
2/8
post-thumbnail
post-custom-banner


๐Ÿ‘“ ์ž ๊น๋งŒ ์ด๊ฑฐ ํ–ˆ๋‹ˆ??!!

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์‚ฌํ•ญ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  • Ubuntu 20.04 ๋ฒ„์ „์ด ๊น”๋ ค ์žˆ๋Š” OS

  • ๋“€์–ผ์ฝ”์–ด ์ด์ƒ์˜ cpu ์™€ 4gb ์ด์ƒ์˜ ๋žจ

    ์›ํ™œํ•œ ์‹คํ–‰์„ ์œ„ํ•ด ํ•„์š”ํ•˜๋ฉฐ ํ•„์ˆ˜๋Š” ์•„๋‹™๋‹ˆ๋‹ค.

    ElasticSearch๋Š” ์ž๋ฐ”๋กœ ๋งŒ๋“ค์–ด์กŒ๊ธฐ ๋•Œ๋ฌธ์— JDK ๊ฐ€ ์„ค์น˜๋˜์–ด์•ผ ํ•˜์ง€๋งŒ ElasticSearch๋ฅผ ์„ค์น˜ํ•˜๋ฉด์„œ JDK ๊ฐ€ ๊ฐ™์ด ๊น”๋ฆฌ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ž๋ฐ” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๋ฉด ์ง€์›ํ•˜๋Š” JDK๋ฅผ ๋‹ค์‹œ ๊น”๊ณ  JAVA_HOME ๋ณ€์ˆ˜๋ฅผ ๋‹ค์‹œ ์„ค์ •ํ•ด์ฃผ์„ธ์š”. Elasticsearch JDK ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ โœˆ


๐Ÿฅฝ ๋”ฐ๋ผ์™€

์„ค์น˜๊ณผ์ •์€ ElasticSearch 7.x ๋ฒ„์ „์„ ๊ธฐ์ค€์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„์ „์ด ๋‹ค๋ฅด๋ฉด ์ˆ˜ํ–‰์ด ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Step 1 - ์„ค ์น˜ ํ•˜ ์ž

  • Ubuntu ์—์„œ๋Š” ElasticSearch ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ด์šฉ์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ apt ๋ช…๋ น์œผ๋กœ ์„ค์น˜ ํ›„ Elastic ์˜ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค๋ฉด ์ด์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ElasticSearch๋Š” ๋„ˆ๋ฅผ ์‚ฌ๋ž‘ํ•ด์„œ Elastic ์ธ์ฆํ‚ค๋กœ ์„œ๋ช…์ด ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.(๋ณด์•ˆ์„ ์œ„ํ•ด์„œ๋ผ๋Š” ๋œป) ํ‚ค๋ฅผ ํ†ตํ•ด ์ธ์ฆ๋ฐ›์€ ํŒจํ‚ค์ง€๋“ค์€ ๋ชจ๋‘ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์„ค์น˜๋ฅผ ์œ„ํ•ด ๋‹ค์Œ์„ ์‹คํ–‰ํ•˜์—ฌ Elastic Public GPG ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”

    $ curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

  • sources.list.d ํด๋”์— Elastic ์†Œ์Šค๋ฆฌ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”! APT ๊ฐ€ ์ƒˆ๋กœ์šด ์†Œ์Šค๋ฅผ ์ฐพ์•„์•ผํ•˜๊ฑฐ๋“ ์š”!! (๋‹ค์Œ ์ž…๋ ฅํ•˜๋ผ๋Š” ๋œป)

    $ echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

  • package lists ๋“ค์„ ์—…๋ฐ์ดํŠธ ํ•ด์•ผ๊ฒ ์ฃ ?

    $ sudo apt update

  • ๋“œ๋””์–ด ์„ค์น˜!

    $ sudo apt install elasticsearch

๋‘๋‘”

Step 2 - ์„ค ์ • ํ•˜ ์ž

  • ๋กœ์ปฌ ๋จธ์‹ ์—์„œ ๋Œ๋ฆฌ๊ธฐ ์œ„ํ•ด์„œ ์•ฝ๊ฐ„์˜ ์ˆ˜์ •์ด ํ•„์š”ํ•˜๋‹ต๋‹ˆ๋‹ค!
    ElasticSearch ๋Š” elasticsearch.yml ์—์„œ ์„ค์ • ๊ด€๋ฆฌ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. (์—ด์–ด๋ผ๋Š” ๋œป)

$ sudo nano /etc/elasticsearch/elasticsearch.yml

  • ๋‚ด๋ ค ๋‚ด๋ ค ๋‚ด๋ ค ๋‚ด๋ ค (๋‹ค์Œ ๊ณผ ๊ฐ™์€ ์˜์—ญ์„ ์ฐพ์•„๋ผ๋Š” ๋œป) ๊ทธ๋ฆฌ๊ณ  ๋ฐ”๊ฟ” (: ์ดํ›„์— ๋‚ด์šฉ์„ ์›ํ•˜๋Š” ๊ฐ’์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.)

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
. . .

์ฃผ์˜ yml ํŒŒ์ผ์€ ํฌ๋งท์ด ๋งค์šฐ ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค ' : ' ๋‹ค์Œ์— ๋ฐ˜๋“œ์‹œ ๋›ฐ์–ด์“ฐ๊ธฐ๋ฅผ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.


Step 3 - ์‹ค ํ–‰ ํ•˜ ์ž

  • systemctl ๋ช…๋ น์œผ๋กœ ์‹คํ–‰ํ•ด๋ด…์‹œ๋‹ค.

  • ์ดˆ๊ธฐ ์ˆ˜ํ–‰์— ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฌ๋‹ˆ ์ž ์‹œ ๊ธฐ๋‹ค๋ ค์ฃผ์„ธ.

    $ sudo systemctl start elasticsearch

  • ํ•œ๋ฒˆ ํ™•์ธํ•ด๋ณผ๊นŒ์š”?

    $ service elasticsearch status

  • ์œ„์˜ ๋ช…๋ น์„ ์ž…๋ ฅํ›„, active running ๋‹จ์–ด๊ฐ€ ๋ณด์ด๋ฉด ์ •์ƒ ์‹คํ–‰์ค‘์ด๋ผ๋Š” ๊ฒ๋‹ˆ๋‹ค. ๋žจ ๋งŽ์ด ์žก์•„๋จน๋„ค์š”.

  • ์ด์ œ ์ปดํ“จํ„ฐ๊ฐ€ ์ผœ์งˆ ๋•Œ๋งˆ๋‹ค ์ž๋™์œผ๋กœ ์‹คํ•ญํ•˜๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค.

    $ sudo systemctl enable elasticsearch

Step 4 - ํ™• ์ธ ํ•˜ ์ž

  • ๋ณ„๋„๋กœ ํฌํŠธ ์„ค์ •์„ ์•ˆํ–ˆ๋‹ค๋ฉด http://localhost:9200 ์œผ๋กœ ์ ‘์†ํ•˜๋ฉด json ํ˜•์‹์œผ๋กœ ๊ฐ’์ด ๋œจ๋ฉด ์„ฑ๊ณต!!

๐Ÿ˜

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค!!

๊ธฐ๋ณธ์ ์ธ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด์„œ๋Š” ๋‹ค์Œ ํฌ์ŠคํŠธ์—์„œ ~

profile
I am two cat's father
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€