Toggle navigation
主页
English
K8S
Golang
Guitar
About Me
归档
标签
Welcome to Sanger's Blog!
elasticsearch 6.x 安装
无
2023-11-15 17:13:26
18
0
0
sanger
[TOC] # 概述 环境:centos 7.x(实际是 Alibaba Cloud Linux (Aliyun Linux) 2.1903 LTS (Hunting Beagle)) 单数据节点,非集群方式 # 准备 ``` #安装jdk1.8环境 yum install -y java-1.8.0-openjdk-devel.x86_64 #下载es rpm包 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.rpm ``` # 安装 ``` rpm -ivh elasticsearch-6.2.4.rpm ``` # 配置 ## /etc/elasticsearch/jvm.options ``` #按需要更改这两项 -Xms4g -Xmx4g ``` ## /etc/elasticsearch/elasticsearch.yml ``` # ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: test # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: test-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # path.data: /var/lib/elasticsearch # # Path to log files: # path.logs: /var/log/elasticsearch # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 192.168.1.123 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # discovery.zen.ping.unicast.hosts: ["192.168.1.123"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # #discovery.zen.minimum_master_nodes: # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true ``` # 启动 ``` systemctl enable elasticsearch systemctl start elasticsearch ``` # 检查 ``` #看看9200和9300是否监听上 netstat -tpnl ``` # 根据业务需求创建索引 ``` PUT /test_xxx_user_info { "settings": { "number_of_shards": 1, "number_of_replicas": 1 }, "mappings": { "_doc": { "properties": { "avatar": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "birthday": { "type": "text" }, "coms": { "properties": { "avatar": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "job_grade_id": { "type": "long" }, "job_grade_name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "job_post_name": { "type": "text" }, "join_time": { "type": "text" }, "leave_time": { "type": "text" }, "org_id": { "type": "long" }, "org_name": { "type": "keyword" }, "staff_id": { "type": "keyword" }, "staff_name": { "type": "keyword" }, "status": { "type": "long" }, "tenant_id": { "type": "long" } } }, "dept_relates": { "properties": { "dept_id": { "type": "long" }, "dept_name": { "type": "keyword" }, "org_id": { "type": "long" }, "tenant_id": { "type": "long" } } }, "depts": { "properties": { "dept_id": { "type": "long" }, "dept_name": { "type": "keyword" }, "is_default": { "type": "boolean" }, "job_post_id": { "type": "long" }, "job_post_name": { "type": "text" }, "leader_id": { "type": "long" }, "org_id": { "type": "long" }, "org_name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "tenant_id": { "type": "long" } } }, "gender": { "type": "long" }, "id": { "type": "keyword" }, "identity": { "type": "keyword" }, "logged": { "type": "long" }, "orgs": { "properties": { "is_default": { "type": "boolean" }, "job_post_id": { "type": "long" }, "job_post_name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "leader_id": { "type": "long" }, "org_id": { "type": "long" }, "org_name": { "type": "keyword" }, "tenant_id": { "type": "long" } } }, "orgs_relates": { "properties": { "org_id": { "type": "long" }, "org_name": { "type": "keyword" }, "tenant_id": { "type": "long" } } }, "phone": { "type": "keyword" }, "real_name": { "type": "keyword" }, "roles": { "properties": { "role_id": { "type": "long" }, "role_name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "tenant_id": { "type": "long" } } }, "user_id": { "type": "long" } } } } } ```
上一篇:
yum安装postgresql 11
下一篇:
mysql 8安装
0
赞
18 人读过
新浪微博
微信
更多分享
腾讯微博
QQ空间
人人网
文档导航