Переглянути джерело

agAdminMonitor等模块改进

erlArango_v1
AICells 5 роки тому
джерело
коміт
37b5981632
3 змінених файлів з 377 додано та 259 видалено
  1. +49
    -18
      src/agApi/agAdminMonitor.erl
  2. +89
    -99
      src/agApi/agFoxxServices.erl
  3. +239
    -142
      src/agApi/agReplication.erl

+ 49
- 18
src/agApi/agAdminMonitor.erl Переглянути файл

@ -7,29 +7,30 @@
% doc_address:https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html
% Permalink读取全局日志
%
% GET /_admin/log
%
% upto必须为
% 0
% 1
% 2
% 3
% debug 4 info
% upto和level是互斥的
% start使lid值start
% size
% offset
% search中指定的文本的日志条目
% sortsort为ascsort为desc asc
% upto upto必须为
% fatal 0
% error或1
% warning或2
% info或3
% debug 4 info
% level upto和level是互斥的
% start使lid值start
% size
% offset
% search search中指定的文本的日志条目
% sortsort为ascsort为desc asc
% JSON对象
% HTTP 200
% lid@LIT {lid}
% level
% timestamp1970-01-01
% text
% topic
% totalAmount
% lid@LIT {lid}
% level
% timestamp1970-01-01
% text
% topic
% totalAmount
% 400up或level指定了无效值
% 500
getAdminLog(PoolNameOrSocket) ->
@ -215,6 +216,36 @@ getAdminProps(PoolNameOrSocket) ->
getAdminStatisticsDesc(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/statistics-description">>, [], undefined).
% TLS
% TLS数据的摘要
% TLS数据CA
% GET /_admin/server/tls
% TLS数据的摘要JSON响应将包含result具有以下组件的字段
% keyfile
% clientCACA的信息
% 使SNISNI
%
% JSON对象
% SHA256SHA256的字符串
% certificatesJSON数组
% privateKeySHA256keyfile clientCASHA256的JSON字符串
% API
%
% 200API将返回HTTP 200
getAdminTLS(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/tls">>, [], undefined).
% TLS数据的重新加载并返回摘要永久链接
% TLS数据CA
% POST /_admin/server/tls
% API调用触发所有TLS数据的重新加载JSON响应与相应的GET请求完全相同
% API
%
% 200API将返回HTTP 200
% 403使APIHTTP 403 FORBIDDEN
triggerAdminTLS(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/server/tls">>, [], undefined).
%
% GET /_admin/metrics
% Prometheus格式返回实例的当前指标Prometheus收集

+ 89
- 99
src/agApi/agFoxxServices.erl Переглянути файл

@ -14,47 +14,44 @@
% Foxx服务管理
% Foxx服务的ArangoDB HTTP接口的简介
%
%
% GET /_api/foxx
%
% excludeSystem
% excludeSystem
%
%
% mount
% developmenttrue
% legacy2.8true
% mount
% developmenttrue
% legacy2.8true
%
%
% name
% versionsemver兼容的版本字符串
% name
% versionsemver兼容的版本字符串
%
% 200
% 200
getFoxxList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx">>, [], undefined).
getFoxxList(PoolNameOrSocket, ExcludeSystem) ->
case ExcludeSystem of
true ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx?excludeSystem=true">>, [], undefined);
_ ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx?excludeSystem=false">>, [], undefined)
end.
getFoxxList(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx", QueryBinary/binary>>, [], undefined).
%
%
% GET /_api/foxx/service
%
% mount
% mount
%
%
% mount
% path
% developmenttrue
% legacy2.8true
% manifestJSON清单
% mount
% path
% developmenttrue
% legacy2.8true
% manifestJSON清单
%
% name
% versionsemver兼容的版本字符串
% name
% versionsemver兼容的版本字符串
%
% 200
% 400
@ -62,47 +59,44 @@ getFoxxService(PoolNameOrSocket, Mount) ->
Path = <<"/_api/foxx/service?mount=", (agMiscUtils:toBinary(Mount))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
%
% POST /_api/foxx
%
% mount
% true为启用开发模式
% false不运行服务的安装脚本
% legacytrue以2.8
% mount
% true为启用开发模式
% false不运行服务的安装脚本
% legacytrue以2.8
%
%
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
%
% configurationJSON对象
% JSON对象
% sourceURL或绝对路径
% configurationJSON对象
% JSON对象
% sourceURL或绝对路径
% 使zip捆绑包或独立JavaScript文件的文件字段
% 使JavaScript文件时HTTP端点main与在服务清单字段中定义的相同
% URL访URLsource是文件系统路径URL都应解析为zip包JavaScript文件或
% 使
%
% 201
% 201
installFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% DELETE /_api/foxx/service
%
% mount
% false不运行服务的拆卸脚本
% mount
% teardown false不运行服务的拆卸脚本
%
%
%
% 204
% 204
uninstallFoxx(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>,
@ -111,18 +105,18 @@ uninstallFoxx(PoolNameOrSocket, QueryPars) ->
%
% PUT /_api/foxx/service
%
% mount
% false不运行旧服务的拆卸脚本
% false不运行新服务的安装脚本
% legacytrue以2.8 Legacy兼容模式安装新服务
% true强制安装服务使
% mount
% teardown false不运行旧服务的拆卸脚本
% setup false不运行新服务的安装脚本
% legacytrue以2.8 Legacy兼容模式安装新服务
% force true强制安装服务使
%
%
%
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
%
% configurationJSON对象
% JSON对象
@ -132,7 +126,7 @@ uninstallFoxx(PoolNameOrSocket, QueryPars) ->
% URL访URLsource是文件系统路径URL都应解析为zip包JavaScript文件或
% 使
%
% 200
% 200
replaceFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>,
@ -142,18 +136,18 @@ replaceFoxx(PoolNameOrSocket, MapData, QueryPars) ->
%
% PATCH /_api/foxx/service
%
% mount
% true运行旧服务的拆卸脚本
% false不运行新服务的安装脚本
% legacytrue以2.8 Legacy兼容模式安装新服务
% true强制安装服务使
% mount
% teardowntrue运行旧服务的拆卸脚本
% setupfalse不运行新服务的安装脚本
% legacytrue以2.8 Legacy兼容模式安装新服务
% forcetrue强制安装服务使
% 使
%
%
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
% application/zipzip捆绑包
% application/javascriptJavaScript文件
% application/jsonJSON
% multipart/form-data
%
% configurationJSON对象
% JSON对象
@ -176,7 +170,7 @@ upgradeFoxx(PoolNameOrSocket, MapData, QueryPars) ->
%
% GET /_api/foxx/configuration
%
% mount
% mount
%
%
%
@ -189,7 +183,7 @@ getFoxxConfig(PoolNameOrSocket, QueryPars) ->
%
% PATCH /_api/foxx/configuration
%
% mount
% mount
% json
% JSON对象映射配置选项名称为其新值
%
@ -205,13 +199,13 @@ updateFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
%
% PUT /_api/foxx/configuration
%
% mount
% mount
% json
% JSON对象映射配置选项名称为其新值
%
%
%
% 200
% 200
replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
@ -221,7 +215,7 @@ replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
%
% GET /_api/foxx/dependencies
%
% mount
% mount
%
%
%
@ -235,13 +229,13 @@ getFoxxDependencies(PoolNameOrSocket, QueryPars) ->
%
% PATCH /_api/foxx/dependencies
%
% mount
% mount
% json
% JSON对象
%
%
%
% 200
% 200
updateFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
@ -251,7 +245,7 @@ updateFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
%
% PUT /_api/foxx/dependencies
%
% mount
% mount
% json
% JSON对象
%
@ -269,11 +263,11 @@ replaceFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
%
% GET /_api/foxx/scripts
%
% mount
% mount
%
%
%
% 200
% 200
getFoxxScripts(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts", QueryBinary/binary>>,
@ -282,15 +276,15 @@ getFoxxScripts(PoolNameOrSocket, QueryPars) ->
%
% POST /_api/foxx/scripts/{name}
%
%
%
%
% mount
% mount
% json
% JSON值
%
%
%
% 200
% 200
runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts/", ScriptName/binary, QueryBinary/binary>>,
@ -300,41 +294,38 @@ runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
%
% POST /_api/foxx/tests
%
% mount
% 记n>使
% 使Accept标头无关
% filter
% mount
% reporter 使
% idiomatic 使Accept标头无关
% filter
%
%
%
% suite
%
% xunitXUnit / JUnit兼容的结构
% tapTAP兼容流
% default
% suite
% stream
% xunitXUnit / JUnit兼容的结构
% tapTAP兼容流
%
% 使application/x-ldjson将导致响应主体被格式化为以换行符分隔的JSON流
% 使text/plain或时text/*TAP报告
% 使xunit报告程序时application/xml或text/xml将导致响应正文被格式化为XML而不是JSONML
% prettyprinted JSON
%
% 200
% 200
runFoxxTest(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/tests", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
%
% POST /_api/foxx/development
%
% mount
% mount
%
%
% ArangoDB时
%
% 200
%
%
% 200
enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/development", QueryBinary/binary>>,
@ -343,7 +334,7 @@ enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
%
% DELETE /_api/foxx/development
%
% mount
% mount
%
% ArangoDB时
%
@ -353,15 +344,14 @@ disableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
Path = <<"/_api/foxx/development", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
%
% GET /_api/foxx/readme
%
% mount
% mount
% README或README.md文件的内容
%
% 200
% 204
% 200
% 204
getFoxxReadme(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/readme", QueryBinary/binary>>,
@ -370,7 +360,7 @@ getFoxxReadme(PoolNameOrSocket, QueryPars) ->
%
% GET /_api/foxx/swagger
%
% mount
% mount
% Swagger API描述
% API的与OpenAPI 2.0JSON描述
%
@ -383,13 +373,13 @@ getFoxxSwagger(PoolNameOrSocket, QueryPars) ->
%
% POST /_api/foxx/download
%
% mount
% mount
% zip捆绑包
%
% ArangoDB实例上安装的服务的版本
%
% 200
% 400
% 200
% 400
downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/download", QueryBinary/binary>>,
@ -398,11 +388,11 @@ downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
%
% POST /_api/foxx/commit
%
% replace使
% replace使
%
%
%
% 204
% 204
commitFoxxState(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/commit", QueryBinary/binary>>,

+ 239
- 142
src/agApi/agReplication.erl Переглянути файл

@ -7,94 +7,105 @@
% doc_address:https://www.arangodb.com/docs/3.6/http/replications.html
% HTTP接口
%
% ArangoDB的HTTP复制接口的介绍
%
% HTTP复制接口有四个主要用途
%
%
%
%
% 使v3.3.0
%
% ArangoDB数据库的当前设置的集合加上他们的指标使使
% ArangoDB数据库的当前设置的集合加上他们的指标使使
%
% GET /_api/replication/inventory
%
% includeSystemtrue
% _system默认值为false
% batchIdAPI调用的RocksDB引擎需要有效的batchId
% includeSystemtrue
% global _system默认值为false
% batchIdAPI调用的RocksDB引擎需要有效的batchId
% 使
% collection和state和 tick属性的JSON对象
%
%
%
% parameters
% indexes
%
% runningArangoDB 2.2true
% lastLogTick
% time
% runningArangoDB 2.2true
% lastLogTick
% time
% lastLogTick值使lastLogTick的值
%
% / inventory API方法lastLogTick值以及集合和索引的数组
% / inventory返回的每个集合/ dump将集合数据流式传输到客户端lastLogTick的值 / inventory报告的集合上创建索引
% / inventory API方法lastLogTick值以及集合和索引的数组
% / inventory返回的每个集合/ dump将集合数据流式传输到客户端lastLogTick的值 / inventory报告的集合上创建索引
%
% / logger-follow来获取在客户端调用/ inventory之后记录的第一批复制事件
% / logger-follow的调用应使用from参数/ inventory报告的lastLogTick的值 / logger-follow将返回 x-arango-replication-lastincluded
% / logger-follow以递增地获取上次传输后发生的新复制事件
% 使from参数 x-arango-replication-lastincluded头的值
% / logger-follow来获取在客户端调用/ inventory之后记录的第一批复制事件
% / logger-follow的调用应使用from参数/ inventory报告的lastLogTick的值 / logger-follow将返回 x-arango-replication-lastincluded
% / logger-follow以递增地获取上次传输后发生的新复制事件
% 使from参数 x-arango-replication-lastincluded头的值
% DBserver DBserver的IDDBserver
% global顶层对象使用参数包含一个键databases datbase名称
%
% 200
% 405使HTTP方法时返回
% 500500
% 200
% 405使HTTP方法时返回
% 500500
getRepInventory(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/inventory", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
%
% POST /_api/replication/batch
%
% JSON对象是必需的
% ttl
% ttl
% JSON对象
% ID
% JSON对象
% idID
% DBserver DBserver的IDDBserver
% idID
% DBserver DBspan>-Server的IDDB服务器Coordinator情况下未绑定此属性
%
% 200
% 400ttl值无效DBserver属性或该属性非法
% 405使HTTP方法时返回
% 200
% 400ttl值无效Coordinator上未指定DBserver属性或该属性非法400
% 405使HTTP方法时返回
newRepBatch(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/replication/batch">>, [], BodyStr).
%
%
%
% DELETE /_api/replication/batch/{id}
%
%
% idID
% idID
%
% DBserver DBserver的IDDBserver
% DBserver DBspan>-Server的IDDB服务器Coordinator情况下未绑定此属性
%
% 204
% 400
% 405使HTTP方法时返回
% 204
% 400
% 405使HTTP方法时返回
delRepBatch(PoolNameOrSocket, BatchId) ->
Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
%
%
% PUT /_api/replication/batch/{id}
%
%
% idID
% idID
% JSON对象是必需的
% ttl
% ttl
% 使ID和提供的ttl值来扩展现有转储批次的ttl
% ttl
% DBserver DBserver的IDDBserver
% DBserver DBspan>-Server的IDDB服务器Coordinator情况下未绑定此属性
%
% 204ttl
% 400ttl值无效或未找到批次
% 405使HTTP方法时返回
% 204ttl
% 400ttl值无效或未找到批次
% 405使HTTP方法时返回
% dump命令的结果可能非常庞大dump可能不会一次返回集合中的所有数据dump命令dump命令不仅会返回集合中的当前文档
% dump方法将仅返回文档
% 使
@ -103,58 +114,153 @@ prolongRepBatch(PoolNameOrSocket, BatchId, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
%
%
% GET /_api/replication/dump
%
% ID
% chunkSize
% batchIdrocksdb-使ID
% frommmfiles-
% mmfiles-
% includeSystemmmfiles-true
% ticksmmfiles-tick值true
% mmfiles-WALtrue
% collection ID
% chunkSize
% batchId使ID
%
% 使from查询参数使from参数时from值的集合条目from的日志条目将被排除
% 使
% CHUNKSIZE查询参数可用于控制结果的大小CHUNKSIZE值也仅是被兑现chunkSize值太低可能导致服务器无法仅将一个条目放入结果中并返回它chunkSize值 chunkSizechunkSize
% chunkSize使
% Content-Type是application / x-arango-dump
% JSON对象
% ticktick属性
% key/使
% rev/ID
% data23002301//
% type
% 2300/
% 2301/
% 2302/
% ticktick属性
% key/使
% rev/ID
% data23002301//
% type
% 2300/
% 2301/
% 2302/
%
%
% 200 x-arango-replication-lastincluded设置为最后返回的文档的刻度
% 204x-arango-replication-lastincluded是0
% 400from或to值无效
% 404
% 405使HTTP方法时返回
% 500500
% 200 x-arango-replication-lastincluded设置为最后返回的文档的刻度
% 204x-arango-replication-lastincluded是0
% 404
% 405使HTTP方法时返回
% 500500
getRepDump(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/dump", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
% Merkle树以进行收集
% Merkle树
% GET /_api/replication/revisions/tree
% RocksDB引擎以及ArangoDB v3.7.0
%
% collectionID
% batchId使ID
% Merkle树
% JSON / VelocyPack
%
% {
% version: <Number>,
% branchingFactor: <Number>
% maxDepth: <Number>,
% rangeMin: <String, revision>,
% rangeMax: <String, revision>,
% nodes: [
% { count: <Number>, hash: <String, revision> },
% { count: <Number>, hash: <String, revision> },
% ...
% { count: <Number>, hash: <String, revision> }
% ]
% }
% 1
% <String, revision>6411使_rev值相同的编码64JavaScript完整表示2^53-1
% maxDepth和 branchingFactorindex 0index [1, branchingFactor]
%
% 200
% 401
% 404
% 405使HTTP方法时返回
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
getRepTree(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/tree", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% Merkle树
% Merkle树
% POST /_api/replication/revisions/tree
% RocksDB引擎以及ArangoDB v3.7.0
%
% collectionID
% Merkle树
%
%
% 204
% 401
% 404
% 405使HTTP方法时返回
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
resetRepTree(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/tree", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
% ID
% ID
% PUT /_api/replication/revisions/ranges
% RocksDB引擎以及ArangoDB v3.7.0
%
% collectionID
% batchId使ID
% resume
getRepRanges(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/ranges", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
%
% PUT /_api/replication/revisions/documents
% RocksDB引擎以及ArangoDB v3.7.0
%
% collectionID
% batchId使ID
%
% JSON / VelocyPackID数组
% [
% <String, revision>,
% <String, revision>,
% ...
% <String, revision>
% ]
%
% JSON / VelocyPack数组
%
% <String, revision>6411使_rev值相同的编码64JavaScript完整表示2^53-1
%
% 200
% 401
% 404
% 405使HTTP方法时返回
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
getRepDoc(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/documents", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
%
% PUT /_api/replication/sync
% JSON对象是必需的
% tcp//192.168.173.138529
% database
% username使ArangoDB用户名
% password使
% includeSystem
% true使false
% strictTypeinclude或exclude
% restrictCollections使 restrictTypelimitType为includelimitType为exclude
% initialSyncMaxWaitTime0
% endpoint tcp//192.168.173.138529
% database
% username使ArangoDB用户名
% password使
% includeSystem
% incrementaltrue使false
% strictTypeinclude或exclude
% restrictCollections使 restrictTypelimitType为includelimitType为exclude
% initialSyncMaxWaitTime0
% ArangoDB数据库的完整数据同步
% 使ArangoDB数据库连接到远程端点ArangoDB数据库上创建数据状态的本地备份
% sync首先会从远程端点获取集合和索引的列表 API来实现ArangoDB数据库中的数据ArangoDB数据库 API
@ -165,56 +271,61 @@ getRepDump(PoolNameOrSocket, QueryPars) ->
% 使
%
%
% 200
% 400
% 405使HTTP方法时返回
% 500
% 501
% 200
% 400
% 405使HTTP方法时返回
% 500
% 501
startRepSync(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/sync">>, [], BodyStr).
%
%
% GET /_api/replication/clusterInventory
% GET /_api/replication/clusterInventory
%
% includeSystemtrue
% includeSystemtrue
%
% JSON对象数组// {DB-} / * arangodump的数据格式
%
% 200
% 405使HTTP方法时返回
% 500500
getRepClusterInventory(PoolNameOrSocket, QueryPars) ->
% 200
% 405使HTTP方法时返回
% 500500
getRepClusterInv(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/clusterInventory", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
% ArangoDB允许启动ArangoDB 2.2
% ArangoDB 2.2
%
%
% GET /_api/replication/logger-state
%
% JSON对象
% stateJSON对象
% running
% lastLogTick
% totalEvents
% time
% serverJSON对象
% version
% serverIdID
% clientJSON对象返回
% syncerIdID
% serverIdID
% lastServedTicklogger-follow API
% timelogger-follow API的日期和时间
% stateJSON对象
% running
% lastLogTick
% totalEvents
% time
% serverJSON对象
% version
% serverIdID
% clientJSON对象返回
% syncerIdID
% serverIdID
% lastServedTicklogger-follow API
% timelogger-follow API的日期和时间
%
% 200
% 405使HTTP方法时返回
% 500
% 200
% 405使HTTP方法时返回
% 500
getRepLoggerState(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-state">>, [], undefined).
%
%
% GET /_api/replication/logger-follow
@ -262,10 +373,10 @@ getRepLoggerState(PoolNameOrSocket) ->
% firstTick的JSON对象
%
%
% 200
% 405使HTTP方法时返回
% 500500
% 501
% 200
% 405使HTTP方法时返回
% 500500
% 501
getRepLoggerFirstTick(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-first-tick">>, [], undefined).
@ -273,24 +384,27 @@ getRepLoggerFirstTick(PoolNameOrSocket) ->
% GET /_api/replication/logger-tick-ranges
% WAL日志文件的刻度值的当前可用范围
% JSON数组
% datafile
% status
% tickMin
% tickMax
% datafile
% status
% tickMin
% tickMax
%
% 200
% 405使HTTP方法时返回
% 500
% 501
% 200
% 405使HTTP方法时返回
% 500
% 501
getRepLoggerTickRanges(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-tick-ranges">>, [], undefined).
%
% applier命令允许远程启动ArangoDB数据库复制应用程序的状态和配置
%
% applier命令允许远程启动ArangoDB数据库复制应用程序的状态和配置
%
% GET /_api/replication/applier-config
%
% truefalse
% global truefalse
%
% JSON对象
% tcp//192.168.173.138529
@ -321,13 +435,9 @@ getRepLoggerTickRanges(PoolNameOrSocket) ->
getRepApplierConfig(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, [], undefined).
getRepApplierConfig(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of
true ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config?global=true">>, [], undefined);
_ ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, [], undefined)
end.
getRepApplierConfig(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config", QueryBinary/binary>>, [], undefined).
%
% PUT /_api/replication/applier-config
@ -367,14 +477,10 @@ setRepApplierConfig(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, [], BodyStr).
setRepApplierConfig(PoolNameOrSocket, MapData, IsGlobal) ->
setRepApplierConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
BodyStr = jiffy:encode(MapData),
case IsGlobal of
true ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config?global=true">>, [], BodyStr);
_ ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, [], BodyStr)
end.
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config", QueryBinary/binary>>, [], BodyStr).
%
% PUT /_api/replication/applier-start
@ -409,13 +515,9 @@ startRepApplier(PoolNameOrSocket, QueryPars) ->
stopRepApplier(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, [], undefined).
stopRepApplier(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of
true ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop?global=true">>, [], undefined);
_ ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, [], undefined)
end.
stopRepApplier(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop", QueryBinary/binary>>, [], undefined).
%
% GET /_api/replication/applier-state
@ -459,14 +561,9 @@ stopRepApplier(PoolNameOrSocket, IsGlobal) ->
getRepApplierState(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, [], undefined).
getRepApplierState(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of
true ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state?global=true">>, [], undefined);
_ ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, [], undefined)
end.
getRepApplierState(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state", QueryBinary/binary>>, [], undefined).
%
% PUT /_api/replication/make-slave

Завантаження…
Відмінити
Зберегти