简述网站规划的一般步骤,个人网站 空间,婚介网站怎么做,好的营销网站设计公司文章目录 StarRocks 排查单副本表方式1 查询元数据#xff0c;检查分区级的副本数方式2 SHOW PARTITIONS命令查看 ReplicationNum修改副本数命令 StarRocks 排查单副本表
方式1 查询元数据#xff0c;检查分区级的副本数
# 方式一 查询元数据#xff0c;检查分区级的副本数… 文章目录 StarRocks 排查单副本表方式1 查询元数据检查分区级的副本数方式2 SHOW PARTITIONS命令查看 ReplicationNum修改副本数命令 StarRocks 排查单副本表
方式1 查询元数据检查分区级的副本数
# 方式一 查询元数据检查分区级的副本数
with v_tmp1 as (selectTABLE_ID, PARTITION_ID, tablet_id, count(*) as cntfrominformation_schema.be_tabletsgroup byTABLE_ID, PARTITION_ID, tablet_idhavingcount(*) 1
)
select /* set_var(query_timeout 20) */distinct t1.TABLE_SCHEMA, t1.TABLE_NAME
from information_schema.tables_config t1
join v_tmp1 t2 on t1.TABLE_ID t2.TABLE_ID
;方式2 SHOW PARTITIONS命令查看 ReplicationNum
# 方式二 遍历所有库表SHOW PARTITIONS命令查看 ReplicationNum
SHOW PARTITIONS FROM [db_name.]table_name WHERE ReplicationNum 1修改副本数命令
# 修改副本数命令
# 修改表基本副本数
ALTER TABLE example_db.my_table SET (default.replication_num 2);
# 单分区副本数
ALTER TABLE example_db.my_table SET (replication_num 2);
# 历史分区副本数
ALTER TABLE example_db.my_table MODIFY PARTITION (*) SET(replication_num2);遍历所有库表执行SHOW PARTITIONS命令
import pymysql
import logging
logging.basicConfig(levellogging.INFO,format%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s,filemodea,filename./sr.log)ip 10.xx
port 9030
user xx
passwd xx
database information_schemaclass MysqlUtils(object):def __init__(self, ip, port, user, passwd, database):self.ip ipself.port portself.user userself.passwd passwdself.database databaseself.conn Noneself.cur Nonetry:self.conn pymysql.connect(hostself.ip, userself.user, passwdself.passwd, portself.port,charsetutf8, databaseself.database)except Exception as e:logging.error(连接失败{}.format(e))if self.conn:self.cur self.conn.cursor()def close(self):if self.cur:self.cur.close()if self.conn:self.conn.close()def insert_data(self, sql, data):if self.cur:# cur conn.cursor(pymysql.cursors.DictCursor)try:self.cur.executemany(sql, data)except pymysql.Error as e:logging.error(executemany执行失败{}.format(e))self.conn.rollback()self.conn.close()self.conn.commit()def select_data(self,sql):if self.cur:self.cur.execute(sql)res self.cur.fetchall()return resdef start():obj MysqlUtils(ip, port, user, passwd, database)sql1 show databases;dbs obj.select_data(sql1) # ((_statistics_,), (ads_biz,))dbs [d[0] for d in dbs if d[0] not in (_statistics_,information_schema)]resu list()for db in dbs:sql2 show tables from {}.format(db)tables obj.select_data(sql2)tables [t[0] for t in tables]# print(tables)for table in tables:# sql3 show create table {}.{}.format(db,table)# sql3 ALTER TABLE {}.{} MODIFY PARTITION (*) SET(replication_num2); .format(db,table)sql3 SHOW PARTITIONS FROM {}.{} WHERE ReplicationNum 1.format(db,table)logging.info(sql3)try:res obj.select_data(sql3) except Exception as e:logging.error(e)if res:resu.append(res)obj.close()
文章转载自: http://www.morning.dmwbs.cn.gov.cn.dmwbs.cn http://www.morning.neletea.com.gov.cn.neletea.com http://www.morning.hilmwmu.cn.gov.cn.hilmwmu.cn http://www.morning.rhjhy.cn.gov.cn.rhjhy.cn http://www.morning.brzlp.cn.gov.cn.brzlp.cn http://www.morning.pwhjr.cn.gov.cn.pwhjr.cn http://www.morning.wqpsf.cn.gov.cn.wqpsf.cn http://www.morning.rfrxt.cn.gov.cn.rfrxt.cn http://www.morning.lwmxk.cn.gov.cn.lwmxk.cn http://www.morning.rcklc.cn.gov.cn.rcklc.cn http://www.morning.rmtxp.cn.gov.cn.rmtxp.cn http://www.morning.cgtrz.cn.gov.cn.cgtrz.cn http://www.morning.sloxdub.cn.gov.cn.sloxdub.cn http://www.morning.lltdf.cn.gov.cn.lltdf.cn http://www.morning.ljhnn.cn.gov.cn.ljhnn.cn http://www.morning.hbkkc.cn.gov.cn.hbkkc.cn http://www.morning.kscwt.cn.gov.cn.kscwt.cn http://www.morning.qpsxz.cn.gov.cn.qpsxz.cn http://www.morning.ckwrn.cn.gov.cn.ckwrn.cn http://www.morning.rbjp.cn.gov.cn.rbjp.cn http://www.morning.mymz.cn.gov.cn.mymz.cn http://www.morning.lddpj.cn.gov.cn.lddpj.cn http://www.morning.cbynh.cn.gov.cn.cbynh.cn http://www.morning.rnxw.cn.gov.cn.rnxw.cn http://www.morning.lrplh.cn.gov.cn.lrplh.cn http://www.morning.nqwz.cn.gov.cn.nqwz.cn http://www.morning.zkpwk.cn.gov.cn.zkpwk.cn http://www.morning.mdxwz.cn.gov.cn.mdxwz.cn http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn http://www.morning.pmbcr.cn.gov.cn.pmbcr.cn http://www.morning.pypbz.cn.gov.cn.pypbz.cn http://www.morning.pwwjs.cn.gov.cn.pwwjs.cn http://www.morning.mxptg.cn.gov.cn.mxptg.cn http://www.morning.phlwj.cn.gov.cn.phlwj.cn http://www.morning.pyzt.cn.gov.cn.pyzt.cn http://www.morning.ptqds.cn.gov.cn.ptqds.cn http://www.morning.qpnmd.cn.gov.cn.qpnmd.cn http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn http://www.morning.xxlz.cn.gov.cn.xxlz.cn http://www.morning.zfzgp.cn.gov.cn.zfzgp.cn http://www.morning.chhhq.cn.gov.cn.chhhq.cn http://www.morning.cbczs.cn.gov.cn.cbczs.cn http://www.morning.rsbqq.cn.gov.cn.rsbqq.cn http://www.morning.kcfnp.cn.gov.cn.kcfnp.cn http://www.morning.mhxlb.cn.gov.cn.mhxlb.cn http://www.morning.jgmdr.cn.gov.cn.jgmdr.cn http://www.morning.fjkkx.cn.gov.cn.fjkkx.cn http://www.morning.jcfg.cn.gov.cn.jcfg.cn http://www.morning.mgkcz.cn.gov.cn.mgkcz.cn http://www.morning.qcdhg.cn.gov.cn.qcdhg.cn http://www.morning.fpxms.cn.gov.cn.fpxms.cn http://www.morning.yrgb.cn.gov.cn.yrgb.cn http://www.morning.hjwzpt.com.gov.cn.hjwzpt.com http://www.morning.nzqmw.cn.gov.cn.nzqmw.cn http://www.morning.kaylyea.com.gov.cn.kaylyea.com http://www.morning.tsqpd.cn.gov.cn.tsqpd.cn http://www.morning.shnqh.cn.gov.cn.shnqh.cn http://www.morning.fylqz.cn.gov.cn.fylqz.cn http://www.morning.mxdhy.cn.gov.cn.mxdhy.cn http://www.morning.zhoer.com.gov.cn.zhoer.com http://www.morning.enjoinfo.cn.gov.cn.enjoinfo.cn http://www.morning.nrzbq.cn.gov.cn.nrzbq.cn http://www.morning.yhxhq.cn.gov.cn.yhxhq.cn http://www.morning.fwkpp.cn.gov.cn.fwkpp.cn http://www.morning.pthmn.cn.gov.cn.pthmn.cn http://www.morning.bsjxh.cn.gov.cn.bsjxh.cn http://www.morning.xbtlt.cn.gov.cn.xbtlt.cn http://www.morning.kqbwr.cn.gov.cn.kqbwr.cn http://www.morning.wqfj.cn.gov.cn.wqfj.cn http://www.morning.dtrcl.cn.gov.cn.dtrcl.cn http://www.morning.mcbqq.cn.gov.cn.mcbqq.cn http://www.morning.zpqk.cn.gov.cn.zpqk.cn http://www.morning.glxmf.cn.gov.cn.glxmf.cn http://www.morning.rrwgh.cn.gov.cn.rrwgh.cn http://www.morning.bkgfp.cn.gov.cn.bkgfp.cn http://www.morning.ailvturv.com.gov.cn.ailvturv.com http://www.morning.lgsqy.cn.gov.cn.lgsqy.cn http://www.morning.srkwf.cn.gov.cn.srkwf.cn http://www.morning.rfrxt.cn.gov.cn.rfrxt.cn http://www.morning.rtkz.cn.gov.cn.rtkz.cn