{"componentChunkName":"component---src-templates-acg-portal-new-template-tsx","path":"/Qmt8gadal","result":{"data":{"markdownRemark":{"html":"<h2 id=\"概述\"><a href=\"#%E6%A6%82%E8%BF%B0\" aria-label=\"概述 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>概述</h2>\n<p>  本文为您介绍ranger权限策略迁移方案，分为3个部分：</p>\n<ol>\n<li>用户组、用户的迁移</li>\n<li>role 迁移 </li>\n<li>用户组、用户的权限策略迁移</li>\n</ol>\n<h2 id=\"前提条件\"><a href=\"#%E5%89%8D%E6%8F%90%E6%9D%A1%E4%BB%B6\" aria-label=\"前提条件 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>前提条件</h2>\n<ul>\n<li>已获取集群 Master 节点的登录方式（内网 IP、绑定 EIP 或 VNC 控制台登录），SSH 登录方式请参考<a href=\"https://cloud.baidu.com/doc/BMR/s/1jx49up59\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SSH连接到集群</a></li>\n<li>已获取ranger-admin服务部署的节点信息，可以通过集群详情 -> 服务管理 -> RANGER -> 部署拓扑 查看</li>\n<li>要添加的用户已经是百度云iam用户</li>\n</ul>\n<h2 id=\"1用户组、用户迁移\"><a href=\"#1%E7%94%A8%E6%88%B7%E7%BB%84%E3%80%81%E7%94%A8%E6%88%B7%E8%BF%81%E7%A7%BB\" aria-label=\"1用户组、用户迁移 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1.用户组、用户迁移</h2>\n<p>使用附件中的工具，可以批量添加用户、用户组</p>\n<p>迁移工具见附件</p>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span>使用样例\n<span class=\"line-number\">2</span>./add_user_group.sh <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">3</span>    -f /user_group.txt <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">4</span>    -b https://bmr.bj.baidubce.com <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">5</span>    -c cluster-id <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">6</span>    -p <span class=\"token string\">'password'</span> <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">7</span>    -k <span class=\"token string\">'&lt;AK>'</span> <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">8</span>    -s <span class=\"token string\">'&lt;SK>'</span></code></pre>\n            </div>\n        </div>\n    </div>\n  \n<h4 id=\"参数\"><a href=\"#%E5%8F%82%E6%95%B0\" aria-label=\"参数 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>参数</h4>\n<table>\n<thead>\n<tr>\n<th>参数</th>\n<th>必填</th>\n<th>说明</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>-f, --file</code></td>\n<td>✅</td>\n<td>关系文件，每行 <code>用户名 用户组</code>（空白分隔，<code>#</code> 为注释）</td>\n</tr>\n<tr>\n<td><code>-b, --base-url</code></td>\n<td>✅</td>\n<td>服务域名，如 <code>https://bmr.bj.baidubce.com</code></td>\n</tr>\n<tr>\n<td><code>-c, --cluster-id</code></td>\n<td>✅</td>\n<td>集群 ID</td>\n</tr>\n<tr>\n<td><code>-p, --password</code></td>\n<td>✅</td>\n<td>明文密码</td>\n</tr>\n<tr>\n<td><code>-k, --access-key</code></td>\n<td>✅</td>\n<td>AK</td>\n</tr>\n<tr>\n<td><code>-s, --secret-key</code></td>\n<td>✅</td>\n<td>SK</td>\n</tr>\n<tr>\n<td><code>--dry-run</code></td>\n<td>否</td>\n<td>只打印请求不执行</td>\n</tr>\n<tr>\n<td><code>-h, --help</code></td>\n<td>否</td>\n<td>帮助</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"关系文件格式\"><a href=\"#%E5%85%B3%E7%B3%BB%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F\" aria-label=\"关系文件格式 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>关系文件格式</h4>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Plain Text</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-text\"><code><span class=\"line-number\">1</span># 每行：用户名 用户组（空白分隔，# 为注释，空行忽略）\n<span class=\"line-number\">2</span>alice developers\n<span class=\"line-number\">3</span>bob developers\n<span class=\"line-number\">4</span>carol ops</code></pre>\n            </div>\n        </div>\n    </div>\n  \n<h4 id=\"依赖\"><a href=\"#%E4%BE%9D%E8%B5%96\" aria-label=\"依赖 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>依赖</h4>\n<table>\n<thead>\n<tr>\n<th>命令</th>\n<th>用途</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>curl</code></td>\n<td>发请求</td>\n</tr>\n<tr>\n<td><code>jq</code></td>\n<td>构造/解析 JSON</td>\n</tr>\n<tr>\n<td><code>openssl</code></td>\n<td>密码 AES 加密</td>\n</tr>\n<tr>\n<td><code>xxd</code></td>\n<td>hex 编解码</td>\n</tr>\n<tr>\n<td><code>python3</code></td>\n<td>生成签名</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"2role迁移\"><a href=\"#2role%E8%BF%81%E7%A7%BB\" aria-label=\"2role迁移 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2.role迁移</h2>\n<p>使用附件中的脚本，role迁移包含两个脚本，分为导入、导出</p>\n<table>\n<thead>\n<tr>\n<th>参数</th>\n<th>含义</th>\n<th>默认值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>--url &#x3C;url></code></td>\n<td>目标 Ranger Admin 地址</td>\n<td><code>http://localhost:6080</code></td>\n</tr>\n<tr>\n<td><code>--auth &#x3C;u:p></code></td>\n<td>目标管理员 <code>user:password</code></td>\n<td><code>admin:admin</code></td>\n</tr>\n<tr>\n<td><code>--in &#x3C;file></code></td>\n<td>输入 JSONL 文件</td>\n<td><code>roles_full.jsonl</code></td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"导出role\"><a href=\"#%E5%AF%BC%E5%87%BArole\" aria-label=\"导出role permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>导出role</h4>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span><span class=\"token comment\">#从源集群导出role信息</span>\n<span class=\"line-number\">2</span><span class=\"token function\">sh</span> ranger-role-export.sh <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">3</span>  --url http://localhost:6080 <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">4</span>  --auth admin:admin <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">5</span>  --out roles_full.jsonl</code></pre>\n            </div>\n        </div>\n    </div>\n  \n<h4 id=\"导入role\"><a href=\"#%E5%AF%BC%E5%85%A5role\" aria-label=\"导入role permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>导入role</h4>\n<p>1.SSH 登录bmr集群Master 节点，参考<a href=\"https://cloud.baidu.com/doc/BMR/s/1jx49up59\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SSH连接到集群</a></p>\n<p>2.把上一步的导出结果上传到节点上，执行导入脚本</p>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span> <span class=\"token comment\">#role信息导入目标集群</span>\n<span class=\"line-number\">2</span> <span class=\"token function\">sh</span> ranger-role-import.sh <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">3</span>  --url http://localhost:6080 <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">4</span>  --auth admin:admin <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">5</span>  --in roles_full.jsonl</code></pre>\n            </div>\n        </div>\n    </div>\n  \n<p>导入后即可在ranger页面查看role信息</p>\n<h2 id=\"3权限策略迁移\"><a href=\"#3%E6%9D%83%E9%99%90%E7%AD%96%E7%95%A5%E8%BF%81%E7%A7%BB\" aria-label=\"3权限策略迁移 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3.权限策略迁移</h2>\n<h4 id=\"导出策略\"><a href=\"#%E5%AF%BC%E5%87%BA%E7%AD%96%E7%95%A5\" aria-label=\"导出策略 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>导出策略</h4>\n<p>从原集群ranger中导出要迁移的服务策略（以hive为例）</p>\n<p><img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b1_160c03d.png\" alt=\"b1.png\"></p>\n<p><img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b2_a1ef3b4.png\" alt=\"b2.png\">\n导出的文件格式为json,格式类似 Ranger_Policies_20260821_062940.json</p>\n<h4 id=\"改写文件\"><a href=\"#%E6%94%B9%E5%86%99%E6%96%87%E4%BB%B6\" aria-label=\"改写文件 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>改写文件</h4>\n<p>如果迁移对象存储的权限策略，需要改写以下两项：</p>\n<ol>\n<li>导出的json文件中serviceType的值改为bos</li>\n</ol>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span><span class=\"token string\">\"rowFilterPolicyItems\"</span><span class=\"token builtin class-name\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span>,\n<span class=\"line-number\">2</span><span class=\"token string\">\"serviceType\"</span><span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"cos\"</span>,   改为 bos\n<span class=\"line-number\">3</span><span class=\"token string\">\"options\"</span><span class=\"token builtin class-name\">:</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code></pre>\n            </div>\n        </div>\n    </div>\n  \n<ol start=\"2\">\n<li>导出的json文件中的path参数需要改为带有 /  前缀</li>\n</ol>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span><span class=\"token string\">\"path\"</span><span class=\"token builtin class-name\">:</span> <span class=\"token punctuation\">{</span>\n<span class=\"line-number\">2</span>    <span class=\"token string\">\"values\"</span><span class=\"token builtin class-name\">:</span> <span class=\"token punctuation\">[</span>\n<span class=\"line-number\">3</span>    <span class=\"token string\">\"tmp\"</span>  改为<span class=\"token string\">\"/tmp\"</span> \n<span class=\"line-number\">4</span>    <span class=\"token punctuation\">]</span>,</code></pre>\n            </div>\n        </div>\n    </div>\n  \n<h4 id=\"导入策略\"><a href=\"#%E5%AF%BC%E5%85%A5%E7%AD%96%E7%95%A5\" aria-label=\"导入策略 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>导入策略</h4>\n<p>把上一步导出的结果导入到目标集群ranger</p>\n<p><img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b3_0f1068b.png\" alt=\"b3.png\"></p>\n<p><img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b4_baaa75a.png\" alt=\"b4.png\">\n选取上一步导出的文件\n<img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b5_dbd521d.png\" alt=\"b5.png\"></p>\n<p><img src=\"https://bce.bdstatic.com/doc/bce-doc/BMR/b6_10df28b.png\" alt=\"b6.png\"></p>\n<h2 id=\"附件\"><a href=\"#%E9%99%84%E4%BB%B6\" aria-label=\"附件 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>附件</h2>\n<p><strong>迁移工具：</strong></p>\n<p><a href=\"https://bmr-bj-public-read.bj.bcebos.com/bce-bmr/doc/ranger%E8%BF%81%E7%A7%BB%E5%B7%A5%E5%85%B7.zip\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://bmr-bj-public-read.bj.bcebos.com/bce-bmr/doc/ranger%E8%BF%81%E7%A7%BB%E5%B7%A5%E5%85%B7.zip</a></p>","fields":{"slug":"Qmt8gadal","title":"权限策略迁移方案","date":"2026-08-25","extractedHeadings":[]},"headings":[{"value":"概述","depth":2},{"value":"前提条件","depth":2},{"value":"1.用户组、用户迁移","depth":2},{"value":"参数","depth":4},{"value":"关系文件格式","depth":4},{"value":"依赖","depth":4},{"value":"2.role迁移","depth":2},{"value":"导出role","depth":4},{"value":"导入role","depth":4},{"value":"3.权限策略迁移","depth":2},{"value":"导出策略","depth":4},{"value":"改写文件","depth":4},{"value":"导入策略","depth":4},{"value":"附件","depth":2}]}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"Qmt8gadal","prev":{"id":"Cm6981x9p","name":"权限策略配置","path":"Cm6981x9p","filePath":"开源组件介绍/Ranger/权限策略配置.md","seo":null,"parentIds":["ejwvxvcqb","9m697v3af"],"parents":[{"id":"ejwvxvcqb","documentId":null,"name":"开源组件介绍","repoName":"BMR","filePath":"开源组件介绍","disabled":false,"path":"ejwvxvcqb","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null},{"id":"9m697v3af","documentId":"ccfc9e54-d10c-423a-afb6-70413669529d","name":"Ranger","repoName":"BMR","filePath":"开源组件介绍/Ranger","disabled":false,"path":"9m697v3af","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null}]},"next":{"id":"1m65wc1lv","name":"Kerberos","path":"1m65wc1lv","filePath":"开源组件介绍/Kerberos/概述.md","seo":null,"parentIds":["ejwvxvcqb","Om65wbmvs"],"parents":[{"id":"ejwvxvcqb","documentId":null,"name":"开源组件介绍","repoName":"BMR","filePath":"开源组件介绍","disabled":false,"path":"ejwvxvcqb","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null},{"id":"Om65wbmvs","documentId":"11120054-c3eb-41b2-bf1a-aa49a2d6dd35","name":"Kerberos","repoName":"BMR","filePath":"开源组件介绍/Kerberos","disabled":false,"path":"Om65wbmvs","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null}]},"parents":[{"id":"ejwvxvcqb","documentId":null,"name":"开源组件介绍","repoName":"BMR","filePath":"开源组件介绍","disabled":false,"path":"ejwvxvcqb","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null},{"id":"9m697v3af","documentId":"ccfc9e54-d10c-423a-afb6-70413669529d","name":"Ranger","repoName":"BMR","filePath":"开源组件介绍/Ranger","disabled":false,"path":"9m697v3af","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null}],"specificSeo":null}}}