es笔记

锁内存
vi /etc/security/limits.conf 增加两行
es soft memlock unlimited
es hard memlock unlimited

vi config/elasticsearch.yml 增加
bootstrap.memory_lock: true

查看状态

curl -XGET 'localhost:9200/_nodes?filter_path=**.mlockall&pretty'


--生产环境

--关闭分片自动迁移
curl -XPUT 'localhost:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d'
{
    "persistent" : {
        "cluster.routing.allocation.enable" : "none"
    }
}
'
--打开分片自动迁移
curl -XPUT 'localhost:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d'
{
    "persistent" : {
        "cluster.routing.allocation.enable" : "all"
    }
}
'
--文档表
curl -XPUT 127.0.0.1:9200/document?pretty -d '
{
    "settings" : {
        "index" : {
            "number_of_shards" : 3 ,
            "number_of_replicas" : 0 
        }
    },
    "mappings" : {
        "document" : {
            "properties" : {
                "lib_id" : {
                    "type" : "long"
                },
                "text" : {
                    "type" : "string",
                    "index" : "analyzed",
                    "analyzer" : "ik_max_word"
                }
            }
        }
    }

}'


/*id结构    uuid$序号 */

curl -XPUT 127.0.0.1:9200/fragment?pretty -d '

{
    "settings" : {
        "index" : {
            "number_of_shards" : 3 ,
            "number_of_replicas" : 0 
        }
    },
    "mappings" : {
        "fragment" : {

            "properties" : {

                "lib_id" : {

                    "type" : "long"

                },

                "text" : {
                    "type" : "string",
                    "index" : "analyzed",
                    "analyzer": "ik_smart",
                    "search_analyzer": "ik_max_word"
                }
            }
        }
    }

}'


--netcache date为yyyyMMdd的Long类型

curl -XPUT 127.0.0.1:9200/net_cache?pretty -d '
{
    "settings" : {
        "index" : {
            "number_of_shards" : 4,
            "number_of_replicas" : 0
        }
    },
    "mappings" : {
        "net_cache" : {
            "properties" : {

               "result_flag" : {
                    "type" : "long"
                },

              "date" : {
                    "type" : "long"
                },

                "data" : {
                   "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        }
    }
}'

--userlib

curl -XPUT 127.0.0.1:9200/user_lib?pretty -d '
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1,
            "number_of_replicas" : 0
        }
    },
    "mappings" : {
        "user_lib" : {
            "properties" : {
                "lib_id" : {
                    "type" : "long"
                },
                "text" : {
                    "type" : "string",
                    "index" : "analyzed",
                    "analyzer" : "ik_max_word"
                },
                "org_uuid" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                },
        "user_uuid" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                },
        "dir_uuid" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                },
        "auto_clear" : {
                    "type" : "long"
                },
        "timestamp" : {
                    "type" : "long"
                },
                "source" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        }
    }
}'

--文献表
curl -XPUT 127.0.0.1:9200/literature?pretty -d '
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1,
            "number_of_replicas" : 0
        }
    },
    "mappings" : {
        "literature" : {
            "properties" : {
                "article_id" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                },
                "lib_id" : {
                    "type" : "long"
                },
                "source" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        }
    }
}'

--索引分片部署
curl -XPOST '192.168.1.101:9200/_cluster/reroute?pretty' -d '{  
    "commands" : [ {  
        "move" : {  
            "index" : "paper", "shard" : 1,   
            "from_node" : "node-100-2", "to_node" : "node-100-1"
        }
    } ]
}'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值