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

广州专业网站设计青岛网站seo诊断

广州专业网站设计,青岛网站seo诊断,个人做电影网站有什么风险,阜宁网站建设服务商本文使用 elasticdump 做数据迁移,支持在线和离线俩种方式,适用于数据量比较小的情况。 1、Node 安装 由于elasticdump 依赖于 node,首先需要安装下node。 1.1、 Linux 安装 $ wget https://nodejs.org/dist/v10.15.0/node-v10.15.0-linu…

在这里插入图片描述

本文使用 elasticdump 做数据迁移,支持在线和离线俩种方式,适用于数据量比较小的情况。

1、Node 安装

由于elasticdump 依赖于 node,首先需要安装下node。

1.1、 Linux 安装

$ wget https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz
$ tar -xf node-v10.15.0-linux-x64.tar.xz
#配置相关的环境变量
$ vim /etc/profile
> PATH=$PATH:/software/node-v10.15.0-linux-x64/bin
$ source /etc/profile

1.2、Windows安装

选择对应的windows版本一路下一步即可,以下是64位的安装包标注:
在这里插入图片描述

2、安装 elasticdump

linux和windows基本相同,建议全局安装下:

#本地安装和全局安装的区别在于它是否自动给你设置环境变量,其他的没有区别
# 本地安装
$ npm install elasticdump
$ ./bin/elasticdump
# 全局安装
$ npm install elasticdump -g
$ elasticdump

3、数据迁移

ES索引的迁移需要一个个的迁移,并且分:analyzer、mapping、data三部分。

备注:
http://production.es.com:9200/my_index 为源索引
http://staging.es.com:9200/my_index 为目标索引
“” 为换行符,一行可以不用写
如果es是有用户密码做为鉴权的,则需要修改下URL:

# 注意 elasticdump 提供给了--httpAuthFile 参数来做认证
--httpAuthFile      When using http auth provide credentials in ini file in form`user=<username>password=<password>`# 只需要写一个ini文件 ,文件中写入用户名和密码就可以了# 这里其实还有另外一个好的方法# 在--input参数和--output参数的的url中添加账号密码# 例如
elasticdump \--input=http://prod-username:prod-passowrd@production.es.com:9200/my_index \--output=http://stage-username:stage-password@staging.es.com:9200/my_index \--type=data

3.1、在线迁移

#拷贝analyzer分词
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=analyzer
#拷贝映射
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=mapping
'#拷贝数据
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=data

3.2、离线迁移

3.2.1 备份

# 备份索引数据到文件里:
elasticdump \--input=http://production.es.com:9200/my_index \--output=/data/my_index_mapping.json \--type=mapping
elasticdump \--input=http://production.es.com:9200/my_index \--output=/data/my_index.json \--type=data# 备份到标准输出,且进行压缩(这里有一个需要注意的地方,我查询索引信息有6.4G,用下面的方式备份后得到一个789M的压缩文件,这个压缩文件解压后有19G):
elasticdump \--input=http://production.es.com:9200/my_index \--output=$ \| gzip > /data/my_index.json.gz# 把一个查询结果备份到文件中
elasticdump \--input=http://production.es.com:9200/my_index \--output=query.json \--searchBody '{"query":{"term":{"username": "admin"}}}'

3.2.2 恢复

# 将备份文件的数据导入ES
elasticdump \--input=./data.json \--output=http://es.com:9200 

4、Docker 环境下ES迁移

# 镜像下载
$ docker pull taskrabbit/elasticsearch-dump
# 下面还是例子:通过镜像导出数据到本地
# 创建一个文件夹用于保存导出数据
$ mkdir -p /root/data
# 下面需要对路径进行映射并执行命令(导出mapping)
$ docker run --rm -ti -v /data:/tmp taskrabbit/elasticsearch-dump \--input=http://production.es.com:9200/my_index \--output=/tmp/my_index_mapping.json \--type=mapping
# 导出(data)
$ docker run --rm -ti -v /root/data:/tmp taskrabbit/elasticsearch-dump \--input=http://192.168.56.104:9200/test_index \--output=/tmp/elasticdump_export.json \--type=data-----------------------------------------------------------------------------
# 以下内容为ES -> ES的数据迁移例子
$ docker run --rm -ti taskrabbit/elasticsearch-dump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=mapping
$ docker run --rm -ti taskrabbit/elasticsearch-dump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=data

5、附录

# Copy an index from production to staging with analyzer and mapping:
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=analyzer
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=mapping
elasticdump \--input=http://production.es.com:9200/my_index \--output=http://staging.es.com:9200/my_index \--type=data# Backup index data to a file:
elasticdump \--input=http://production.es.com:9200/my_index \--output=/data/my_index_mapping.json \--type=mapping
elasticdump \--input=http://production.es.com:9200/my_index \--output=/data/my_index.json \--type=data# Backup and index to a gzip using stdout:
elasticdump \--input=http://production.es.com:9200/my_index \--output=$ \| gzip > /data/my_index.json.gz# Backup the results of a query to a file
elasticdump \--input=http://production.es.com:9200/my_index \--output=query.json \--searchBody='{"query":{"term":{"username": "admin"}}}'# Copy a single shard data:
elasticdump \--input=http://es.com:9200/api \--output=http://es.com:9200/api2 \--params='{"preference" : "_shards:0"}'# Backup aliases to a file
elasticdump \--input=http://es.com:9200/index-name/alias-filter \--output=alias.json \--type=alias# Import aliases into ES
elasticdump \--input=./alias.json \--output=http://es.com:9200 \--type=alias# Backup templates to a file
elasticdump \--input=http://es.com:9200/template-filter \--output=templates.json \--type=template# Import templates into ES
elasticdump \--input=./templates.json \--output=http://es.com:9200 \--type=template# Split files into multiple parts
elasticdump \--input=http://production.es.com:9200/my_index \--output=/data/my_index.json \--fileSize=10mb# Import data from S3 into ES (using s3urls)
elasticdump \--s3AccessKeyId "${access_key_id}" \--s3SecretAccessKey "${access_key_secret}" \--input "s3://${bucket_name}/${file_name}.json" \--output=http://production.es.com:9200/my_index# Export ES data to S3 (using s3urls)
elasticdump \--s3AccessKeyId "${access_key_id}" \--s3SecretAccessKey "${access_key_secret}" \--input=http://production.es.com:9200/my_index \--output "s3://${bucket_name}/${file_name}.json"
http://www.ds6.com.cn/news/1336.html

相关文章:

  • 网站页面配色分析自己怎么免费做网站
  • 如何建设彩票网站定制网站和模板建站
  • dw做的网站如何使用cps推广接单平台
  • 网站挂马解决seo工作流程图
  • 双柏县住房和城乡建设局网站成品短视频app源码的优点
  • 网站建设主要哪些内容深圳优化服务
  • 甘肃省住房和城乡建设厅注册中心网站首页网站公司
  • 网站建设费入官网建站多少钱
  • 鹤壁建设网站小网站搜什么关键词
  • 专做专业课视频的网站邹平县seo网页优化外包
  • 网站建设公司渠道百度关键词刷搜索量
  • 怎么查看网站域名网站设计制作
  • 山东网站建设团队seo黑帽有哪些技术
  • 新余代网站建设公司sem扫描电子显微镜
  • 福州做公司网站企业网站seo平台
  • 视频网站后台登陆linux网站入口
  • 国外服务器下载湖南seo网站开发
  • 广告创意设计模板兰州seo外包公司
  • 建站之星安装模板失败百度贴吧怎么做推广
  • php网站开发试卷优化排名seo
  • 电商平台站内推广有哪些2022年国际十大新闻
  • 音乐APP网站开发文案代写收费标准
  • 大良营销网站建设好么域名收录查询工具
  • 4s店网站建设爱站工具包官网下载
  • 做相亲网站赚钱吗网站搜索排名优化软件
  • 做网站容易还是做小程序容易国内搜索引擎大全
  • 国内做房车游网站b站新人视频怎么推广
  • 免费商城版网站电商关键词seo排名
  • 建设安全备案登入那个网站上海营销seo
  • 网站打不开怎么办短视频推广渠道