blob: d70928b7972d6115e94f59e3a0767c7402a878d0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pegasus | Table Env</title>
<link rel="stylesheet" href="/zh/assets/css/app.css">
<link rel="shortcut icon" href="/zh/assets/images/favicon.ico">
<link rel="stylesheet" href="/zh/assets/css/utilities.min.css">
<link rel="stylesheet" href="/zh/assets/css/docsearch.v3.css">
<script src="/assets/js/jquery.min.js"></script>
<script src="/assets/js/all.min.js"></script>
<script src="/assets/js/docsearch.v3.js"></script>
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Table Env | Pegasus</title>
<meta name="generator" content="Jekyll v4.3.3" />
<meta property="og:title" content="Table Env" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="介绍" />
<meta property="og:description" content="介绍" />
<meta property="og:site_name" content="Pegasus" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2024-04-22T13:02:52+00:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Table Env" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2024-04-22T13:02:52+00:00","datePublished":"2024-04-22T13:02:52+00:00","description":"介绍","headline":"Table Env","mainEntityOfPage":{"@type":"WebPage","@id":"/administration/table-env"},"url":"/administration/table-env"}</script>
<!-- End Jekyll SEO tag -->
</head>
<body>
<div class="dashboard is-full-height">
<!-- left panel -->
<div class="dashboard-panel is-medium is-hidden-mobile pl-0">
<div class="dashboard-panel-header has-text-centered">
<a href="/zh/">
<img src="/assets/images/pegasus-logo-inv.png" style="width: 80%;">
</a>
</div>
<div class="dashboard-panel-main is-scrollable pl-6">
<aside class="menu">
<p class="menu-label">Pegasus 产品文档</p>
<ul class="menu-list">
<li>
<a href="/zh/docs/downloads"
class="">
下载
</a>
</li>
</ul>
<p class="menu-label">编译构建</p>
<ul class="menu-list">
<li>
<a href="/zh/docs/build/compile-by-docker"
class="">
使用 Docker 完成编译(推荐)
</a>
</li>
<li>
<a href="/zh/docs/build/compile-from-source"
class="">
从源码编译
</a>
</li>
</ul>
<p class="menu-label">客户端库</p>
<ul class="menu-list">
<li>
<a href="/zh/clients/java-client"
class="">
Java 客户端
</a>
</li>
<li>
<a href="/zh/clients/cpp-client"
class="">
C++ 客户端
</a>
</li>
<li>
<a href="https://github.com/apache/incubator-pegasus/tree/master/go-client"
class="">
Golang 客户端
</a>
</li>
<li>
<a href="/zh/clients/python-client"
class="">
Python 客户端
</a>
</li>
<li>
<a href="/zh/clients/node-client"
class="">
NodeJS 客户端
</a>
</li>
<li>
<a href="/zh/clients/scala-client"
class="">
Scala 客户端
</a>
</li>
</ul>
<p class="menu-label">生态工具</p>
<ul class="menu-list">
<li>
<a href="/zh/docs/tools/shell"
class="">
Pegasus Shell 工具
</a>
</li>
<li>
<a href="https://github.com/pegasus-kv/admin-cli"
class="">
集群管理命令行
</a>
</li>
<li>
<a href="https://github.com/pegasus-kv/pegic"
class="">
数据访问命令行
</a>
</li>
</ul>
<p class="menu-label">用户接口</p>
<ul class="menu-list">
<li>
<a href="/zh/api/ttl"
class="">
TTL
</a>
</li>
<li>
<a href="/zh/api/single-atomic"
class="">
单行原子操作
</a>
</li>
<li>
<a href="/zh/api/redis"
class="">
Redis 适配
</a>
</li>
<li>
<a href="/zh/api/geo"
class="">
GEO 支持
</a>
</li>
<li>
<a href="/zh/api/http"
class="">
HTTP 接口
</a>
</li>
</ul>
<p class="menu-label">高效运维</p>
<ul class="menu-list">
<li>
<a href="/zh/administration/deployment"
class="">
集群部署
</a>
</li>
<li>
<a href="/zh/administration/config"
class="">
配置说明
</a>
</li>
<li>
<a href="/zh/administration/rebalance"
class="">
负载均衡
</a>
</li>
<li>
<a href="/zh/administration/monitoring"
class="">
可视化监控
</a>
</li>
<li>
<a href="/zh/administration/rolling-update"
class="">
集群重启和升级
</a>
</li>
<li>
<a href="/zh/administration/scale-in-out"
class="">
集群扩容缩容
</a>
</li>
<li>
<a href="/zh/administration/resource-management"
class="">
资源管理
</a>
</li>
<li>
<a href="/zh/administration/cold-backup"
class="">
冷备份
</a>
</li>
<li>
<a href="/zh/administration/meta-recovery"
class="">
元数据恢复
</a>
</li>
<li>
<a href="/zh/administration/replica-recovery"
class="">
Replica 数据恢复
</a>
</li>
<li>
<a href="/zh/administration/zk-migration"
class="">
Zookeeper 迁移
</a>
</li>
<li>
<a href="/zh/administration/table-migration"
class="">
Table 迁移
</a>
</li>
<li>
<a href="/zh/administration/table-soft-delete"
class="">
Table 软删除
</a>
</li>
<li>
<a href="/zh/administration/table-env"
class="is-active">
Table 环境变量
</a>
</li>
<li>
<a href="/zh/administration/remote-commands"
class="">
远程命令
</a>
</li>
<li>
<a href="/zh/administration/partition-split"
class="">
Partition-Split
</a>
</li>
<li>
<a href="/zh/administration/duplication"
class="">
跨机房同步
</a>
</li>
<li>
<a href="/zh/administration/compression"
class="">
数据压缩
</a>
</li>
<li>
<a href="/zh/administration/throttling"
class="">
流量控制
</a>
</li>
<li>
<a href="/zh/administration/experiences"
class="">
运维经验
</a>
</li>
<li>
<a href="/zh/administration/manual-compact"
class="">
Manual Compact 功能
</a>
</li>
<li>
<a href="/zh/administration/usage-scenario"
class="">
Usage Scenario 功能
</a>
</li>
<li>
<a href="/zh/administration/bad-disk"
class="">
坏盘检修
</a>
</li>
<li>
<a href="/zh/administration/whitelist"
class="">
Replica Server 白名单
</a>
</li>
<li>
<a href="/zh/administration/backup-request"
class="">
Backup Request
</a>
</li>
<li>
<a href="/zh/administration/hotspot-detection"
class="">
热点检测
</a>
</li>
</ul>
</aside>
</div>
</div>
<!-- main section -->
<div class="dashboard-main is-scrollable">
<nav class="navbar is-hidden-desktop">
<div class="navbar-brand">
<a href="/zh/" class="navbar-item">
<!-- Pegasus Icon -->
<img src="/assets/images/pegasus-square.png">
</a>
<div class="navbar-item">
<!--A simple language switch button that only supports zh and en.-->
<!--IF its language is zh, then switches to en.-->
<!--If you don't want a url to be relativized, you can add a space explicitly into the href to
prevents a url from being relativized by polyglot.-->
<a class="button is-light is-outlined is-inverted" href=" /administration/table-env"><strong>En</strong></a>
</div>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navMenu">
<!-- Appears in mobile mode only -->
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div class="navbar-menu" id="navMenu">
<div class="navbar-end">
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
Pegasus 产品文档
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/docs/downloads"
class="navbar-item ">
下载
</a>
</div>
</div>
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
编译构建
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/docs/build/compile-by-docker"
class="navbar-item ">
使用 Docker 完成编译(推荐)
</a>
<a href="/zh/docs/build/compile-from-source"
class="navbar-item ">
从源码编译
</a>
</div>
</div>
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
客户端库
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/clients/java-client"
class="navbar-item ">
Java 客户端
</a>
<a href="/zh/clients/cpp-client"
class="navbar-item ">
C++ 客户端
</a>
<a href="https://github.com/apache/incubator-pegasus/tree/master/go-client"
class="navbar-item ">
Golang 客户端
</a>
<a href="/zh/clients/python-client"
class="navbar-item ">
Python 客户端
</a>
<a href="/zh/clients/node-client"
class="navbar-item ">
NodeJS 客户端
</a>
<a href="/zh/clients/scala-client"
class="navbar-item ">
Scala 客户端
</a>
</div>
</div>
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
生态工具
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/docs/tools/shell"
class="navbar-item ">
Pegasus Shell 工具
</a>
<a href="https://github.com/pegasus-kv/admin-cli"
class="navbar-item ">
集群管理命令行
</a>
<a href="https://github.com/pegasus-kv/pegic"
class="navbar-item ">
数据访问命令行
</a>
</div>
</div>
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
用户接口
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/api/ttl"
class="navbar-item ">
TTL
</a>
<a href="/zh/api/single-atomic"
class="navbar-item ">
单行原子操作
</a>
<a href="/zh/api/redis"
class="navbar-item ">
Redis 适配
</a>
<a href="/zh/api/geo"
class="navbar-item ">
GEO 支持
</a>
<a href="/zh/api/http"
class="navbar-item ">
HTTP 接口
</a>
</div>
</div>
<!--dropdown-->
<div class="navbar-item has-dropdown is-hoverable">
<a href=""
class="navbar-link ">
<span>
高效运维
</span>
</a>
<div class="navbar-dropdown">
<a href="/zh/administration/deployment"
class="navbar-item ">
集群部署
</a>
<a href="/zh/administration/config"
class="navbar-item ">
配置说明
</a>
<a href="/zh/administration/rebalance"
class="navbar-item ">
负载均衡
</a>
<a href="/zh/administration/monitoring"
class="navbar-item ">
可视化监控
</a>
<a href="/zh/administration/rolling-update"
class="navbar-item ">
集群重启和升级
</a>
<a href="/zh/administration/scale-in-out"
class="navbar-item ">
集群扩容缩容
</a>
<a href="/zh/administration/resource-management"
class="navbar-item ">
资源管理
</a>
<a href="/zh/administration/cold-backup"
class="navbar-item ">
冷备份
</a>
<a href="/zh/administration/meta-recovery"
class="navbar-item ">
元数据恢复
</a>
<a href="/zh/administration/replica-recovery"
class="navbar-item ">
Replica 数据恢复
</a>
<a href="/zh/administration/zk-migration"
class="navbar-item ">
Zookeeper 迁移
</a>
<a href="/zh/administration/table-migration"
class="navbar-item ">
Table 迁移
</a>
<a href="/zh/administration/table-soft-delete"
class="navbar-item ">
Table 软删除
</a>
<a href="/zh/administration/table-env"
class="navbar-item is-active">
Table 环境变量
</a>
<a href="/zh/administration/remote-commands"
class="navbar-item ">
远程命令
</a>
<a href="/zh/administration/partition-split"
class="navbar-item ">
Partition-Split
</a>
<a href="/zh/administration/duplication"
class="navbar-item ">
跨机房同步
</a>
<a href="/zh/administration/compression"
class="navbar-item ">
数据压缩
</a>
<a href="/zh/administration/throttling"
class="navbar-item ">
流量控制
</a>
<a href="/zh/administration/experiences"
class="navbar-item ">
运维经验
</a>
<a href="/zh/administration/manual-compact"
class="navbar-item ">
Manual Compact 功能
</a>
<a href="/zh/administration/usage-scenario"
class="navbar-item ">
Usage Scenario 功能
</a>
<a href="/zh/administration/bad-disk"
class="navbar-item ">
坏盘检修
</a>
<a href="/zh/administration/whitelist"
class="navbar-item ">
Replica Server 白名单
</a>
<a href="/zh/administration/backup-request"
class="navbar-item ">
Backup Request
</a>
<a href="/zh/administration/hotspot-detection"
class="navbar-item ">
热点检测
</a>
</div>
</div>
</div>
</div>
</nav>
<nav class="navbar is-hidden-mobile">
<div class="navbar-start w-full">
<div class="navbar-item pl-0 w-full">
<!--TODO(wutao): Given the limitation of docsearch that couldn't handle multiple input,
I make searchbox only shown in desktop. Fix this issue when docsearch.js v3 released.
Related issue: https://github.com/algolia/docsearch/issues/230-->
<div id="docsearch"></div>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item">
<!--A simple language switch button that only supports zh and en.-->
<!--IF its language is zh, then switches to en.-->
<!--If you don't want a url to be relativized, you can add a space explicitly into the href to
prevents a url from being relativized by polyglot.-->
<a class="button is-light is-outlined is-inverted" href=" /administration/table-env"><strong>En</strong></a>
</div>
</div>
</nav>
<section class="hero is-info lg:mr-3">
<div class="hero-body">
<p class="title is-size-2 is-centered">Table 环境变量</p>
</div>
</section>
<section class="section" style="padding-top: 2rem;">
<div class="content">
<h1 id="介绍">介绍</h1>
<p>为了对 table 的一些行为进行控制,Pegasus 提供了 table 环境变量,又称之为 <code class="language-plaintext highlighter-rouge">app envs</code></p>
<p>Table 环境变量以 map 的形式存储在该表的元数据中(Thrift 结构 <code class="language-plaintext highlighter-rouge">app_info</code> 中),并持久化到 Apache Zookeeper 上。</p>
<p>通过 shell 工具的 <a href="/zh/docs/tools/shell/#ls"><code class="language-plaintext highlighter-rouge">ls</code> 命令</a> 查看表信息,最后一列 <code class="language-plaintext highlighter-rouge">envs_count</code> 指明了该表的环境变量个数。例如:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&gt;&gt;&gt; ls
[general_info]
app_id status app_name app_type partition_count replica_count is_stateful create_time drop_time drop_expire envs_count
2 AVAILABLE temp pegasus 8 3 true 2024-04-15_06:58:38 - - 1
</code></pre></div></div>
<p>如果要查看具体的 table 环境变量,则需要使用 <a href="#get_app_envs">get_app_envs</a> 命令。</p>
<p>Table 环境变量具有如下特性:</p>
<ul>
<li>作为 table 的元数据持久化到 Apache Zookeeper 上。</li>
<li>可以通过命令行动态修改,修改成功后会立即更新到 Apache Zookeeper 上。</li>
<li>通过 Meta Server 和 Replica Server 的周期性同步消息 <code class="language-plaintext highlighter-rouge">config_sync</code> 同步给各个 Replica Server 生效。
<blockquote>
<p>由于是周期性同步,所以环境变量更新后可能不会在 Replica Server 上立即生效,而是有一个延迟。这个延迟时间依赖于配置 <code class="language-plaintext highlighter-rouge">config_sync_interval_ms</code> 的值,默认是 30 秒。</p>
</blockquote>
</li>
<li>环境变量的 key 通常使用 <code class="language-plaintext highlighter-rouge">.</code> 分隔,方便分类。</li>
</ul>
<p>目前通过 table 环境变量支持的功能如:</p>
<ul>
<li><a href="manual-compact">Manual-Compact 功能</a></li>
<li><a href="usage-scenario">Usage-Scenario 功能</a></li>
</ul>
<h1 id="控制命令">控制命令</h1>
<p>Pegasus 的 <a href="/zh/docs/tools/shell/">Shell 工具</a> 中提供了操作 table 环境变量的命令。这些命令执行前都需要先执行 <code class="language-plaintext highlighter-rouge">use &lt;table_name&gt;</code> 选择需要操作的表。</p>
<h2 id="get_app_envs">get_app_envs</h2>
<p>参考:<a href="/zh/docs/tools/shell/#get_app_envs"><code class="language-plaintext highlighter-rouge">get_app_envs</code> 命令</a></p>
<h2 id="set_app_envs">set_app_envs</h2>
<p>参考:<a href="/zh/docs/tools/shell/#set_app_envs"><code class="language-plaintext highlighter-rouge">set_app_envs</code> 命令</a></p>
<h2 id="del_app_envs">del_app_envs</h2>
<p>参考:<a href="/zh/docs/tools/shell/#del_app_envs"><code class="language-plaintext highlighter-rouge">del_app_envs</code> 命令</a></p>
<h2 id="clear_app_envs">clear_app_envs</h2>
<p>参考:<a href="/zh/docs/tools/shell/#clear_app_envs"><code class="language-plaintext highlighter-rouge">clear_app_envs</code> 命令</a></p>
<h1 id="支持的环境变量">支持的环境变量</h1>
<p>从 Pegasus 2.6 开始,可通过 Meta Server 的 <a href="/zh/api/http">HTTP 接口</a> <code class="language-plaintext highlighter-rouge">/envs/list</code> 获取所有支持的 table 环境变量。
例如:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 127.0.0.1:34601/envs/list
{
"business.info": {
"limitation": "",
"sample": "",
"type": "string"
},
"default_ttl": {
"limitation": "&gt;= 0",
"sample": "86400",
"type": "unsigned int32"
},
"manual_compact.disabled": {
"limitation": "true | false",
"sample": "true",
"type": "bool"
},
"manual_compact.max_concurrent_running_count": {
"limitation": "&gt;= 0",
"sample": "8",
"type": "unsigned int32"
},
"manual_compact.once.bottommost_level_compaction": {
"limitation": "force | skip",
"sample": "skip",
"type": "string"
},
"manual_compact.once.target_level": {
"limitation": "-1 or &gt;= 1",
"sample": "6",
"type": "unsigned int64"
},
"manual_compact.once.trigger_time": {
"limitation": "&gt; 0, timestamp (in seconds) to trigger the once manual compaction",
"sample": "1700000000",
"type": "unsigned int64"
},
"manual_compact.periodic.bottommost_level_compaction": {
"limitation": "force | skip",
"sample": "skip",
"type": "string"
},
"manual_compact.periodic.target_level": {
"limitation": "-1 or &gt;= 1",
"sample": "6",
"type": "unsigned int64"
},
"manual_compact.periodic.trigger_time": {
"limitation": "",
"sample": "",
"type": "string"
},
"replica.backup_request_throttling": {
"limitation": "&lt;size[K|M]&gt;*&lt;delay|reject&gt;*&lt;milliseconds&gt;",
"sample": "10000*delay*100,20000*reject*100",
"type": "string"
},
"replica.deny_client_request": {
"limitation": "timeout*all | timeout*write | timeout*read | reconfig*all | reconfig*write | reconfig*read",
"sample": "timeout*all",
"type": "string"
},
"replica.read_throttling": {
"limitation": "&lt;size[K|M]&gt;*&lt;delay|reject&gt;*&lt;milliseconds&gt;",
"sample": "10000*delay*100,20000*reject*100",
"type": "string"
},
"replica.read_throttling_by_size": {
"limitation": "",
"sample": "20000*delay*100,20000*reject*100",
"type": "string"
},
"replica.rocksdb_block_cache_enabled": {
"limitation": "true | false",
"sample": "true",
"type": "bool"
},
"replica.rocksdb_iteration_threshold_time_ms": {
"limitation": "&gt;= 0",
"sample": "1000",
"type": "unsigned int64"
},
"replica.slow_query_threshold": {
"limitation": "&gt;= 20",
"sample": "1000",
"type": "unsigned int64"
},
"replica.split.validate_partition_hash": {
"limitation": "true | false",
"sample": "true",
"type": "bool"
},
"replica.write_throttling": {
"limitation": "&lt;size[K|M]&gt;*&lt;delay|reject&gt;*&lt;milliseconds&gt;",
"sample": "10000*delay*100,20000*reject*100",
"type": "string"
},
"replica.write_throttling_by_size": {
"limitation": "&lt;size[K|M]&gt;*&lt;delay|reject&gt;*&lt;milliseconds&gt;",
"sample": "10000*delay*100,20000*reject*100",
"type": "string"
},
"replica_access_controller.allowed_users": {
"limitation": "",
"sample": "",
"type": "string"
},
"replica_access_controller.ranger_policies": {
"limitation": "",
"sample": "",
"type": "string"
},
"rocksdb.allow_ingest_behind": {
"limitation": "true | false",
"sample": "true",
"type": "bool"
},
"rocksdb.checkpoint.reserve_min_count": {
"limitation": "&gt; 0",
"sample": "2",
"type": "unsigned int32"
},
"rocksdb.checkpoint.reserve_time_seconds": {
"limitation": "&gt;= 0",
"sample": "3600",
"type": "unsigned int32"
},
"rocksdb.num_levels": {
"limitation": "In range [1, 10]",
"sample": "6",
"type": "unsigned int64"
},
"rocksdb.usage_scenario": {
"limitation": "bulk_load | normal | prefer_write",
"sample": "normal",
"type": "string"
},
"rocksdb.write_buffer_size": {
"limitation": "In range [16777216, 536870912]",
"sample": "16777216",
"type": "unsigned int64"
},
"user_specified_compaction": {
"limitation": "",
"sample": "",
"type": "string"
}
}
</code></pre></div></div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content is-small has-text-centered">
<div style="margin-bottom: 20px;">
<a href="http://incubator.apache.org">
<img src="/assets/images/egg-logo.png"
width="15%"
alt="Apache Incubator"/>
</a>
</div>
Copyright &copy; 2023 <a href="http://www.apache.org">The Apache Software Foundation</a>.
Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version
2.0</a>.
<br><br>
Apache Pegasus is an effort undergoing incubation at The Apache Software Foundation (ASF),
sponsored by the Apache Incubator. Incubation is required of all newly accepted projects
until a further review indicates that the infrastructure, communications, and decision making process
have stabilized in a manner consistent with other successful ASF projects. While incubation status is
not necessarily a reflection of the completeness or stability of the code, it does indicate that the
project has yet to be fully endorsed by the ASF.
<br><br>
Apache Pegasus, Pegasus, Apache, the Apache feather logo, and the Apache Pegasus project logo are either
registered trademarks or trademarks of The Apache Software Foundation in the United States and other
countries.
</div>
</div>
</footer>
</div>
<!-- right panel -->
<div class="dashboard-panel is-small is-scrollable is-hidden-mobile">
<p class="menu-label">
<span class="icon">
<i class="fa fa-bars" aria-hidden="true"></i>
</span>
本页导航
</p>
<ul class="menu-list">
<li><a href="#介绍">介绍</a></li>
<li><a href="#控制命令">控制命令</a>
<ul>
<li><a href="#get_app_envs">get_app_envs</a></li>
<li><a href="#set_app_envs">set_app_envs</a></li>
<li><a href="#del_app_envs">del_app_envs</a></li>
<li><a href="#clear_app_envs">clear_app_envs</a></li>
</ul>
</li>
<li><a href="#支持的环境变量">支持的环境变量</a></li>
</ul>
</div>
</div>
<script src="/assets/js/app.js" type="text/javascript"></script>
<script>
docsearch({
container: '#docsearch',
appId: 'QRN30RBW0S',
indexName: 'pegasus-apache',
apiKey: 'd3a3252fa344359766707a106c4ed88f',
debug: true
});
</script>
</body>
</html>