5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

お題は不問!Qiita Engineer Festa 2023で記事投稿!

manticoresearch インストール(CentOS7)

Last updated at Posted at 2023-06-30

いつか記事にできればと温めておりました。開発パッケージではありますが、ManticoreSearchにてLogstashからのデータインサート時における自動スキーマに対応したようです!

ということ早速試したいと思います。

1. 環境

OS: CentOS 7.9 (3.10.0-1160.92.1)
CPU: 8CPU(11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz)
Mem: 8GB

2. OS最新化

いつもの通り、最新化しておきます。

yum -y update
timedatectl set-timezone Asia/Tokyo
yum install vim wget git
vim /etc/selinux/config    #無効化しておきます。
reboot

3. manticoresearchインストール

試験的にfirewalldも止めています。

systemctl stop firewalld
systemctl disable firewalld
yum -y install https://repo.manticoresearch.com/manticore-repo.noarch.rpm
yum -y --enablerepo manticore-dev install manticore manticore-extra manticore-common manticore-server manticore-server-core manticore-tools manticore-executor manticore-buddy manticore-backup manticore-columnar-lib manticore-server-core-debuginfo manticore-tools-debuginfo manticore-columnar-lib-debuginfo  manticore-icudata

4. 設定ファイル編集

デフォルトだとlocalhostでポートが上がるので、サーバのローカルIPに変更します。

vim /etc/manticoresearch/manticore.conf

searchd {
    listen = XX.XX.XX.XX:9312             #サーバのIPに変更
    listen = XX.XX.XX.XX:9306:mysql    #サーバのIPに変更
    listen = XX.XX.XX.XX:9308:http     #サーバのIPに変更
    log = /var/log/manticore/searchd.log
    query_log = /var/log/manticore/query.log
    pid_file = /run/manticore/searchd.pid
    data_dir = /var/lib/manticore
}
:wq

サービス起動します。

systemctl enable manticore
systemctl start manticore

動作確認用にMariadbのクライアントパッケージを入れます。

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash
yum -y install MariaDB-client.x86_64

5. Logstash OSSのインストール

別Linuxノードから以下のコマンドを実行してLogstashをインストールします。
※対応しているLogstashが7.13以下となりますので、ご注意ください。

wget https://artifacts.elastic.co/downloads/logstash/logstash-oss-7.12.1-x86_64.rpm
rpm -ivh logstash-oss-7.12.1-x86_64.rpm

6. Logstash設定ファイルを作成

テスト用のファイルを作成します。

vim /etc/logstash/conf.d/file.conf
input {
    stdin {
        codec => json
    }
}

output {
    stdout {
        codec => rubydebug
    }
    elasticsearch {
        index => "testindex0002"
        hosts => ["http://"ManticoreSearchのIP:9308"]
        ilm_enabled => false
        manage_template => false
    }
}
:wq

7. Logstash起動

では、Logstashを起動します

/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/file.conf
Using bundled JDK: /usr/share/logstash/jdk
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
//・・・・・・・・・・省略・・・・・・・・・
[INFO ] 2023-06-30 15:24:34.860 [[main]-pipeline-manager] javapipeline - Pipeline started {"pipeline.id"=>"main"}
The stdin plugin is now waiting for input:
[INFO ] 2023-06-30 15:24:34.890 [Agent thread] agent - Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}

標準入力からJSON形式の内容をコンソールに貼り付けます。

{ "amaount": 10, "quantity": 2}         #貼り付け

#結果
#↓
{
    "@timestamp" => 2023-06-30T06:24:38.451Z,
       "amaount" => 10,
      "quantity" => 2,
      "@version" => "1",
          "host" => "manticore-logstash"
}

成功しました!では、ManticoreSearch側でも見てみましょう。

mysql -P 9306 -u root -h "ManticoreSearchのIP"
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 6.0.5 1399e6f6b@230629 dev (columnar 2.0.5 106d244@230620) (secondary 2.0.5 106d244@230620) git branch master...origin/master

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show tables;     # indexの確認
+---------------+------+
| Index         | Type |
+---------------+------+
| testindex0002 | rt   |
+---------------+------+
2 rows in set (0.000 sec)

MySQL [(none)]> select * from testindex0002;    # indexデータの確認
+---------------------+--------------------------+----------+--------------------+---------+----------+
| id                  | @timestamp               | @version | host               | amaount | quantity |
+---------------------+--------------------------+----------+--------------------+---------+----------+
| 4974179136428834818 | 2023-06-30T06:24:38.451Z | 1        | manticore-logstash |      10 |        2 |
+---------------------+--------------------------+----------+--------------------+---------+----------+
1 row in set (0.001 sec)

MySQL [(none)]>

いかがでしたでしょうか?

まだ開発パッケージであり正式リリースはされていないものの、処理速度などからOpenSearchやElasticSearchの代わりになりうるの可能性が飛躍したなと自分は感じました!

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?