当前位置: 首页 > wzjs >正文

新站seo竞价seo快速收录快速排名

新站seo竞价,seo快速收录快速排名,张家港网站建设模板,网站关键词优化难不难手搓 步骤 修改模板分词计算新的索引名称删除之前索引别名新建索引 修改模板分词器类型并根据索引名称重新生成新索引 #!/bin/bashred_text() {echo -e "\033[31m$1\033[0m" }# 定义一个显示绿色文本的函数 green_text() {echo -e "\033[32m$1\033[0m"…

手搓

步骤

  1. 修改模板分词
  2. 计算新的索引名称
  3. 删除之前索引别名
  4. 新建索引

修改模板分词器类型并根据索引名称重新生成新索引

#!/bin/bashred_text() {echo -e "\033[31m$1\033[0m"
}# 定义一个显示绿色文本的函数
green_text() {echo -e "\033[32m$1\033[0m"
}echo "            ===========开始初始化ES 7.6.x==========="
#address="http://172.30.3.226:9200"
address="http://10.11.55.53:9200"
# 账号和密码
username="elastic"
password="Esb@123"#msg_trace esb-m-trace-logs
#msg_sendlog esb-m-produce-logs
#msg_recvlog esb-m-consume-logs
#msg_systemapplog esb-middleware-app-monitor-logs
#msg_sendersituation esb-statistics-logsnon_body_index_list=("esb-m-produce-logs")
index_list=()#是否删除存在的index 0表示不删除,1表示删除
delete_index=1#es配置文件是否配置node.attr.box_type,配置了是1,不配置是0。
node_attr_box_type_config=0# 设置max_size变量 gb 建议25gb
max_size=25#天 建议30
max_age=30max_docs_non_message_body=200000000
max_docs=50000000max_result_window=1000000echo "address: ${address}"
echo "username: ${username}"
echo "password: ${password}"
echo "non_body_index_list: ${non_body_index_list}"
echo "index_list: ${index_list}"
echo "max_size: ${max_size}gb"
echo "max_age: ${max_age}gb"
echo "max_docs_non_message_body: ${max_docs_non_message_body}"
echo "max_docs: ${max_docs}"echo "---------------------------------------------------------------------------"echo ""
echo ""
echo ""
echo ""
echo ""
echo "            ===========2. 开始创建 ES索引模版 ==========="echo "正在创建ES索引模版(${non_body_index_list}):"
for item in "${non_body_index_list[@]}"; do
url=${address}"/_template/${item}_template"
echo "url >>>> "$url
data=$(cat <<EOF
{"order": 0,"index_patterns": ["${item}-*"],"settings": {"index": {"lifecycle": {"name": "ilm-fm","rollover_alias": "${item}"},"max_result_window": "${max_result_window}","refresh_interval": "10s","analysis": {"analyzer": {"oap_log_analyzer": {"type": "ik_max_word"},"oap_log_search_analyzer": {"type": "ik_smart"}}},"number_of_shards": "1","number_of_replicas": "1"}},"mappings": {"_source": {},"_meta": {},"properties": {}}
}
EOF
)  
result=$(curl -X PUT -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)
echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "创建ES索引模版成功。${item}_template"
elsesuccess=0red_text "创建ES索引模版失败!${item}_template"
fi
doneecho "            ===========2. 创建 ES索引模版 结束 ==========="echo "------------------------------------------------------------------------------"echo ""
echo ""
echo ""
echo ""
echo ""
echo "            ===========3. 开始创建 ES索引 ==========="echo "正在创建ES索引${non_body_index_list}:"
for item in "${non_body_index_list[@]}"; do
url=${address}echo "url >>>> "$url
# 定义 Elasticsearch 地址和基础索引名称# 获取所有匹配的索引
index_names=$(curl -s PUT -u "${username}:${password}" -H "Content-Type: application/json" "${address}/_cat/indices/${item}-*?h=index" | tr -d '\r')# 将索引名称转换为数组
indices=($index_names)# 提取后缀并找到最大值
max_suffix=0
for index in "${indices[@]}"; doecho "获取到的index == $index"# 截取后缀数字部分#suffix=$(echo "$index" | grep -E -o "$item.*([0-9]+)$" | grep -E -o "[0-9]+" | sed 's/^0*//') suffix=$(echo "$index" | grep -E -o "$item.*([0-9]+)$" | grep -E -o "[0-9]+" | sed 's/^0*//')# 如果suffix为空,将其设为0if [ -z "$suffix" ]; thensuffix=0fi# 将后缀转为数字# num=$(printf "%d" "$suffix")if ! [[ "$suffix" =~ ^[0-9]+$  ]]; thenred_text "截取到的后缀不是数字"$suffixelse if [[ "$suffix" -gt "$max_value" ]]; thenmax_value="$suffix"fifi
done# 输出最大值加一的结果,格式化为六位数字
new_suffix=$(printf "%06d" $((max_value + 1)))# 生成新的索引名称new_index_name="${item}-${new_suffix}"
echo "max_value =========>>>> "$max_value
echo "new_index_name =========>>>> "$new_index_name
# 删除之前索引的别名
old_suffix=$(printf "%06d" $((max_value)))
echo "需要删除别名的索引 =========>>>> "$old_suffix
echo "==========删除别名========"
old_index="${item}-${old_suffix}"
data=$(cat <<EOF
{"actions": [{"remove": {"index": "${old_index}","alias": "${item}"}}]
}
EOF
)  
url=${address}"/_aliases"
result=$(curl -X POST  -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)
echo "删除之前索引的别名,执行结果:"$result
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "删除之前索引的别名。"${item}
elsesuccess=0red_text "删除之前索引的别名!${item},建议设置delete_index=1"
fi
url=${address}"/${new_index_name}"
echo "url >>>> "$url
data=$(cat <<EOF
{"settings": {"number_of_shards": 1,"number_of_replicas": 0,"analysis": {"analyzer": {"ik_max_word": {"type": "custom","tokenizer": "ik_max_word"},"ik_smart": {"type": "custom","tokenizer": "ik_smart"}}}},"mappings": {"properties": {"content": {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_smart"}}},"aliases": {"${item}": {"is_write_index": true}}
}
EOF
)  
result=$(curl -X PUT -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)
echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "创建ES索引成功。"${item}
elsesuccess=0red_text "创建ES索引失败!${item},建议设置delete_index=1"
fi
doneecho ""
echo "            ===========3. 创建 ES索引 结束 ==========="echo ""
if [[ $success -eq 1 ]]; thengreen_text ">>>>>>>>>>>>>更新ES成功<<<<<<<<<<<<<<"
elsered_text "!!!!!!!!!!!!!!更新ES失败!!!!!!!!!!!!!!!"
fiecho ""
echo ""
echo ""
echo ""
echo " ==========更新结束 ==========="

自动

  1. 修改模板
  2. 执行模板自动创建索引

 

#!/bin/bashred_text() {echo -e "\033[31m$1\033[0m"
}# 定义一个显示绿色文本的函数
green_text() {echo -e "\033[32m$1\033[0m"
}echo "            ===========开始修改ES 7.6.x==========="
#address="http://172.30.3.226:9200"
address="http://10.11.55.53:9200"
# 账号和密码
username="elastic"
password="Esb@123"#msg_trace esb-m-trace-logs
#msg_sendlog esb-m-produce-logs
#msg_recvlog esb-m-consume-logs
#msg_systemapplog esb-middleware-app-monitor-logs
#msg_sendersituation esb-statistics-logs#non_body_index_list=("esb-statistics-logs" "esb-m-consume-logs" "esb-m-trace-logs")
#index_list=("esb-middleware-app-monitor-logs" "esb-m-produce-logs")
index_list=("esb-middleware-app-monitor-logs" "esb-m-produce-logs")
#是否删除存在的index 0表示不删除,1表示删除
delete_index=1#es配置文件是否配置node.attr.box_type,配置了是1,不配置是0。
node_attr_box_type_config=0# 设置max_size变量 gb 建议25gb
max_size=20#天 建议30
max_age=17max_docs_non_message_body=200000000
max_docs=50000000max_result_window=1000000echo "address: ${address}"
echo "username: ${username}"
echo "password: ${password}"
echo "non_body_index_list: ${non_body_index_list}"
echo "index_list: ${index_list}"
echo "max_size: ${max_size}gb"
echo "max_age: ${max_age}gb"
echo "max_docs_non_message_body: ${max_docs_non_message_body}"
echo "max_docs: ${max_docs}"echo "---------------------------------------------------------------------------"echo ""
echo ""
echo ""
echo ""
echo ""echo ""
echo "            ===========1. 开始修改 ES索引模版 ==========="echo "正在修改non_body_index_list 集合ES索引模版(${non_body_index_list}):"
for item in "${non_body_index_list[@]}"; do
url=${address}"/_template/${item}_template"
echo "url >>>> "$url
data=$(cat <<EOF
{"order": 0,"index_patterns": ["${item}-*"],"settings": {"index": {"lifecycle": {"name": "ilm-fm","rollover_alias": "${item}"},"max_result_window": "${max_result_window}","refresh_interval": "10s","analysis": {"analyzer": {"oap_log_analyzer": {"type": "ik_max_word"},"oap_log_search_analyzer": {"type": "ik_smart"},"default": {  // 设置默认分词器"type": "ik_max_word"  // 使用 IK 分词器的细粒度模式}	}},"number_of_shards": "1","number_of_replicas": "1"}},"mappings": {"_source": {},"_meta": {},"properties": {}}
}
EOF
)  
result=$(curl -X PUT -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)
echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "修改ES索引模版成功。${item}_template"
elsesuccess=0red_text "修改ES索引模版失败!${item}_template"
fi
doneecho ""
echo "正在修改index_list集合ES索引模版(${index_list})"
for item in "${index_list[@]}"; do
url=${address}"/_template/${item}_template"
echo "url >>>> "$url
data=$(cat <<EOF
{"order": 0,"index_patterns": ["${item}-*"],"settings": {"index": {"lifecycle": {"name": "ilm-fm-large","rollover_alias": "${item}"},"max_result_window": "${max_result_window}","refresh_interval": "10s","analysis": {"analyzer": {"oap_log_analyzer": {"type": "ik_max_word"},"oap_log_search_analyzer": {"type": "ik_smart"},"default": {  // 设置默认分词器"type": "ik_max_word"  // 使用 IK 分词器的细粒度模式}	}},"number_of_shards": "1","number_of_replicas": "1"}},"mappings": {"_source": {},"_meta": {},"properties": {}}
}EOF
)  
result=$(curl -X PUT -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)
echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "修改ES索引模版成功。${item}_template"
elsesuccess=0red_text "修改ES索引模版失败!${item}_template"
fi
doneecho "            ===========1. 修改 ES索引模版 结束 ==========="echo "------------------------------------------------------------------------------"echo ""
echo ""
echo ""
echo ""
echo "            ===========2. 强制滚动生命周期 ==========="echo "强制滚动生命周期 ES索引集合 (${non_body_index_list}):"
for item in "${non_body_index_list[@]}"; do
echo "url >>>> "$url
url=${address}"/${item}/_rollover"
data=$(cat <<EOF
{"conditions": {}
}
EOF
)
result=$(curl -X POST -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "强制滚动生命周期成功。${item}"
elsesuccess=0red_text "强制滚动生命周期失败!${item}"
fi
doneecho "强制滚动生命周期 ES索引集合 (${index_list}):"
for item in "${index_list[@]}"; do
echo "url >>>> "$url
url=${address}"/${item}/_rollover"
data=$(cat <<EOF
{"conditions": {}
}
EOF
)
result=$(curl -X POST -u "${username}:${password}" -H "Content-Type: application/json" -d "$data" $url)echo "执行结果:"$result
# 判断结果是否包含"acknowledged":true
if [[ $result == *'"acknowledged":true'* ]]; thengreen_text "强制滚动生命周期成功。${item}"
elsesuccess=0red_text "强制滚动生命周期失败!${item}"
fi
done

http://www.dtcms.com/wzjs/66017.html

相关文章:

  • 遂宁市住房与城乡建设厅网站谷歌seo是什么职业
  • 做网站 做手机app要学什么网站seo批量查询工具
  • 全球网站建设品牌seo入门培训班
  • .net网站开发实训代码新疆今日头条新闻
  • 做网站还是软件整站优化提升排名
  • 山西住房建设厅官方网站口碑营销5t
  • 导航滑动整屏网站品牌网站建设解决方案
  • 绍兴做网站外链网盘系统
  • app开发公司哪里好qq关键词排名优化
  • 做网站最低级的软件网络推广深圳有效渠道
  • 德阳公司做网站中国最新消息
  • 内网网站模板最近一周的重大热点新闻
  • 杭州互联网网站公司中企动力做网站推广靠谱吗
  • mac os建设网站的软件湘潭网站建设
  • 钱宝做任务的网站怎么下联赛积分榜排名
  • 设计师网址导航优缺点东莞seo排名收费
  • 论坛网站建设软件软文300字介绍商品
  • 广州市住房城乡建设局网站做网络推广为什么会被抓
  • 陕西咸阳做网站的公司如何seo网站推广
  • 网站集约化建设困难百度引擎搜索引擎
  • 网站优化哪家专业国外独立网站如何建站
  • 网站建设的意义seo页面链接优化
  • 公众号和网站先做哪个比较好搜索关键词然后排名怎样提升
  • 建筑公司网站宣传建筑工地文案范文图片企业建网站一般要多少钱
  • 营口网站开发百度竞价优化
  • 义乌外贸公司网站网络广告的计费方式
  • 企业购 网站建设crm网站
  • 简单网站制作推广网站免费
  • 设计网站建优化内容
  • 凡客官网首页西安seo技术