首页 > 数据库 >KingbaseES V8R6集群运维案例之---数据库实例initdb后配置

KingbaseES V8R6集群运维案例之---数据库实例initdb后配置

时间:2024-04-01 15:48:24浏览次数:52  
标签:node esrep null V8R6 运维 text --- repmgr id

案例说明:
KingbaseES V8R6集群在数据库实例启动时需加载repmgr插件,并且具有集群管理的用户esrep和存储元数据的数据库esrep库;但在手工initdb新的实例后,默认的实例将不包含repmgr extension及esrep库和esrep用户,需要手工配置,完善集群管理应用。

适用版本:
KingbaseES V8R6

一、默认repmgr集群管理配置

如下图所示,需要在kingbase.conf中配置repmgr extension的加载:

如下所示,集群管理需要创建esrep用户、esrep库及repmgr插件:

test=# \l esrep
                             List of databases
 Name  | Owner  | Encoding |   Collate   |    Ctype    | Access privileges
-------+--------+----------+-------------+-------------+-------------------
 esrep | system | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
(1 row)


test=# \du esrep
           List of roles
 Role name | Attributes | Member of
-----------+------------+-----------
 esrep     | Superuser  | {}

esrep=# \dx repmgr
                 List of installed extensions
  Name  | Version | Schema |           Description
--------+---------+--------+----------------------------------
 repmgr | 5.1     | repmgr | Replication manager for Kingbase

二、执行initdb初始化实例

1、initdb初始化实例
[kingbase@node101 bin]$ ./initdb -U system -W -E utf8 --enable-ci -D /data/kingbase/has/data

2、查看初始化实例extension配置
如下所示,在shared_preload_libraries配置中,默认无repmgr的加载:

[kingbase@node101 bin]$ cat /data/kingbase/has/data/kingbase.conf|grep -i shared_

shared_preload_libraries = 'liboracle_parser, synonym, plsql, force_view, kdb_flashback,plugin_debugger, plsql_plugin_debugger, plsql_plprofiler, ora_commands,
kdb_ora_expr, sepapower, dblink, sys_kwr, sys_ksh, sys_spacequota, sys_stat_statements, backtrace, kdb_utils_function, auto_bmr, sys_squeeze, src_restrict'

3、查看esrep和resrep库信息

如下所示,默认创建新实例后,并不包含esrep用户和esrep库:

prod=# \l esrep
                             List of databases
 Name  | Owner  | Encoding |   Collate   |    Ctype    | Access privileges
-------+--------+----------+-------------+-------------+-------------------

(0 row)

prod=# \du esrep
           List of roles
 Role name | Attributes | Member of
-----------+------------+-----------

三、配置repmgr extension及esrep用户和库

1、加载repmgr extension

2、创建esrep库和esrep用户

test=# create database esrep;
CREATE DATABASE
test=# create user esrep with superuser password 'Kingbaseha110';
CREATE ROLE
##注意:esrep用户的密码和.encpwd文件中用户密码要匹配

test=# alter user esrep with superuser;
ALTER ROLE
test=# \du esrep
           List of roles
 Role name | Attributes | Member of
-----------+------------+-----------
 esrep     | Superuser  | {}

3、创建repmgr extension

test=# \c esrep
You are now connected to database "esrep" as user "system".
esrep=# create extension repmgr;
CREATE EXTENSION

4、查看repmgr schema下的对象

如下所示,在创建repmgr extension后,自动创建repmgr schema及集群元数据存储对象:

esrep=# \d repmgr.*
                Table "repmgr.conf"
 Column  |  Type   | Collation | Nullable | Default
---------+---------+-----------+----------+---------
 node_id | integer |           | not null |
 key     | text    |           | not null |
 value   | text    |           | not null |

                                 Table "repmgr.events"
     Column      |           Type           | Collation | Nullable |      Default
-----------------+--------------------------+-----------+----------+-------------------
 node_id         | integer                  |           | not null |
 event           | text                     |           | not null |
 successful      | boolean                  |           | not null | true
 event_timestamp | timestamp with time zone |           | not null | CURRENT_TIMESTAMP
 details         | text                     |           |          |

               Index "repmgr.idx_monitoring_history_time"
      Column       |           Type           | Key? |    Definition
-------------------+--------------------------+------+-------------------
 last_monitor_time | timestamp with time zone | yes  | last_monitor_time
 standby_node_id   | integer                  | yes  | standby_node_id
btree, for table "repmgr.monitoring_history"

                           Table "repmgr.monitoring_history"
          Column           |           Type           | Collation | Nullable | Default
---------------------------+--------------------------+-----------+----------+---------
 primary_node_id           | integer                  |           | not null |
 standby_node_id           | integer                  |           | not null |
 last_monitor_time         | timestamp with time zone |           | not null |
 last_apply_time           | timestamp with time zone |           |          |
 last_wal_primary_location | pg_lsn                   |           | not null |
 last_wal_standby_location | pg_lsn                   |           |          |
 replication_lag           | bigint                   |           | not null |
 apply_lag                 | bigint                   |           | not null |
Indexes:
    "idx_monitoring_history_time" btree (last_monitor_time, standby_node_id)

                                  Table "repmgr.nodes"
      Column      |            Type            | Collation | Nullable |     Default
------------------+----------------------------+-----------+----------+-----------------
 node_id          | integer                    |           | not null |
 upstream_node_id | integer                    |           |          |
 active           | boolean                    |           | not null | true
 node_name        | text                       |           | not null |
 type             | text                       |           | not null |
 location         | text                       |           | not null | 'default'::text
 priority         | integer                    |           | not null | 100
 conninfo         | text                       |           | not null |
 repluser         | character varying(63 char) |           | not null |
 slot_name        | text                       |           |          |
 config_file      | text                       |           | not null |
 primary_seen     | boolean                    |           |          |
 lsn              | pg_lsn                     |           |          |
Indexes:
    "nodes_pkey" PRIMARY KEY, btree (node_id)
Check constraints:
    "nodes_type_check" CHECK (type = ANY (ARRAY['primary'::text, 'standby'::text, 'witness'::text, 'bdr'::text]))
Foreign-key constraints:
    "nodes_upstream_node_id_fkey" FOREIGN KEY (upstream_node_id) REFERENCES repmgr.nodes(node_id) DEFERRABLE
Referenced by:
    TABLE "repmgr.nodes" CONSTRAINT "nodes_upstream_node_id_fkey" FOREIGN KEY (upstream_node_id) REFERENCES repmgr.nodes(node_id) DEFERRABLE

       Index "repmgr.nodes_pkey"
 Column  |  Type   | Key? | Definition
---------+---------+------+------------
 node_id | integer | yes  | node_id
primary key, btree, for table "repmgr.nodes"

                           View "repmgr.replication_status"
          Column           |           Type           | Collation | Nullable | Default
---------------------------+--------------------------+-----------+----------+---------
 primary_node_id           | integer                  |           |          |
 standby_node_id           | integer                  |           |          |
 standby_name              | text                     |           |          |
 node_type                 | text                     |           |          |
 active                    | boolean                  |           |          |
 last_monitor_time         | timestamp with time zone |           |          |
 last_wal_primary_location | pg_lsn                   |           |          |
 last_wal_standby_location | pg_lsn                   |           |          |
 replication_lag           | text                     |           |          |
 replication_time_lag      | pg_catalog.interval      |           |          |
 apply_lag                 | text                     |           |          |
 communication_time_lag    | pg_catalog.interval      |           |          |

                   View "repmgr.show_nodes"
       Column       |  Type   | Collation | Nullable | Default
--------------------+---------+-----------+----------+---------
 node_id            | integer |           |          |
 node_name          | text    |           |          |
 active             | boolean |           |          |
 upstream_node_id   | integer |           |          |
 upstream_node_name | text    |           |          |
 type               | text    |           |          |
 priority           | integer |           |          |
 conninfo           | text    |           |          |

            Table "repmgr.voting_term"
 Column |  Type   | Collation | Nullable | Default
--------+---------+-----------+----------+---------
 term   | integer |           | not null |
Indexes:
    "voting_term_restrict" UNIQUE, btree ((true))
Rules:
    voting_term_delete AS
    ON DELETE TO repmgr.voting_term DO INSTEAD NOTHING

 Index "repmgr.voting_term_restrict"
 Column |  Type   | Key? | Definition
--------+---------+------+------------
 bool   | boolean | yes  | (true)
unique, btree, for table "repmgr.voting_term"

四、总结
KingbaseES V8R6集群管理需要加载repmgr插件及创建集群管理的数据库esrep和esrep用户,在集群重新初始化实例后,并不包含以上对象,需要配置后,才能用于集群管理。

标签:node,esrep,null,V8R6,运维,text,---,repmgr,id
From: https://www.cnblogs.com/kingbase/p/17736809.html

相关文章

  • KingbaseES V8R3集群运维案例---主库OOM故障分析
    案例说明:KingbaseESV8R3集群,主库数据库OOM,产生core,请帮忙分析。数据库内存64Gb,为华为云虚拟机,无swap。适用版本:KingbaseESV8R3一、问题分析1、查看sys_log数据库OOM信息PortalMemory:8192totalin1blocks;7888free(0chunks);304usedPortalHeapMemory:1......
  • KingbaseES V8R6集群运维案例之---备节点恢复为单实例库
    KingbaseESV8R6集群运维案例之---备节点恢复为单实例库案例说明:在生产环境中,手工将集群节点恢复为单实例节点,操作可以分为两步。第一步,先将节点从repmgr管理中注销,脱离集群的管理;第二步,从流复制中拆分节点,成为单实例节点。适用版本:KingbaseESV8R6集群架构:ID......
  • KingbaseES V8R6集群案例之---同城双中心集群部署
    案例说明:本案例描述了在KingbaseESV8R6下部署同城双中心集群的过程,通过脚本的方式执行执行部署,部署方式和普通集群脚本部署基本一致。适用版本:KingbaseESV8R6集群架构:[kingbase@node101~]$cat/etc/hosts192.168.1.101node1192.168.1.102node2192.168.1.103......
  • ShadowToy-Smooth Mouse Drawing
    ShadowToy-SmoothMouseDrawing源码分析简概SmoothMouseDrawing源码分析学习。源码Image//Arecreationofhttps://lazybrush.dulnan.net///Controls://-Mousetodraw//-L:togglebetweenquadraticbeziercurvesandlinesegments//-S:toggleSDFv......
  • 02-03线性代数
    2.3线性代数1.基本数学对象对象数学符号代码标量xtorch.tensor(1.0)向量xtorch.arange(3)矩阵Atorch.arange(20).reshape(5,4)张量Xtorch.arange(24).reshape(2,3,4)2.基本运算法则及方法2.1标量加法x+y;乘法x*y;除法x/y;指......
  • 韦东山-数码相框(2)
    字符编码字符编码简介字符(character)是计算机与人交互的媒介,人虽然可以看懂二进制串,但文字是更加直观的。所以需要用数字来表示字符,字符与数字的对应关系就叫编码(coding)。ASCII:使用1个字节表示字符,8位二进制一共可表示256个不同的值,但实际只用到了前面的128个位置。GBK:双字......
  • Vue学习笔记69--activated + deactivated
    activated+deactivated注:生命周期学习可参考学习笔记33两个新的生命周期钩子作用:路由组件所独有的两个构造,用于捕获路由组件的激活状态具体名称:activated--路由组件被激活时触发+deactivated--路由组件失活时触发 示例如下所示:1<template>2<div>3<......
  • 动态修改el-input的样式
    1.在css中定义变量(前边要加--) 2.el-input使用 3.data定义 来源:动态修改el-input样式,css变量形式外层修改input样式-m2maomao-博客园(cnblogs.com)......
  • 【吊打面试官系列】Redis篇 -都有哪些办法可以降低 Redis 的内存使用情况呢?
    大家好,我是锋哥。今天分享关于【都有哪些办法可以降低Redis的内存使用情况呢?】面试题,希望对大家有帮助;都有哪些办法可以降低Redis的内存使用情况呢?如果你使用的是32位的Redis实例,可以好好利用Hash,list,sortedset,set等集合类型数据,因为通常情况下很多小的Key......
  • 微服务篇---springcloud高频面试题(2)☁️
    SpringCloud项目中有没有做过限流?怎么做的?Nginx限流-控制速率Nginx限流-控制连接数......