当前位置: 首页>>代码示例>>Python>>正文


Python GpactivateStandby.get_standby_dd方法代码示例

本文整理汇总了Python中mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby.get_standby_dd方法的典型用法代码示例。如果您正苦于以下问题:Python GpactivateStandby.get_standby_dd方法的具体用法?Python GpactivateStandby.get_standby_dd怎么用?Python GpactivateStandby.get_standby_dd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby的用法示例。


在下文中一共展示了GpactivateStandby.get_standby_dd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_inject_primary_after_promote

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
    def test_inject_primary_after_promote(self):
        """ 
        Promote to standby, bring down primary segments, run gprecoverseg.
        """
        tinctest.logger.info("-failover to standby, inject primary segments, and recoverseg")
        # get standby host, port, and master data directory
        activatestdby = GpactivateStandby()
        self.standby_host = activatestdby.get_current_standby()
        self.standby_mdd = activatestdby.get_standby_dd()
        self.standby_port = activatestdby.get_standby_port()
        activatestdby.activate()   

        # bring down primary segments
        inject_cmd = 'gpfaultinjector -f postmaster -m async -y panic -r primary -H ALL'
        activatestdby.run_remote(self.standby_host, inject_cmd, self.standby_port, self.standby_mdd)

        # wait till segments come up in change tracking
        self.wait_till_changetracking_transition(self.standby_host, self.standby_port)

        # recoverseg from new master
        (rc, stdout) = activatestdby.run_remote(self.standby_host,'gprecoverseg -a',self.standby_port,self.standby_mdd)
        tinctest.logger.info("in test_inject_primary_after_promote:  gprecoverseg -a:  %s"%stdout)

        keyword = 'Segment Pairs in Resynchronization'
        self.wait_till_insync_transition(activatestdby,self.standby_host,self.standby_port,self.standby_mdd,keyword,False)

        # rebalance from new master
        (rc, stdout) = activatestdby.run_remote(self.standby_host,'gprecoverseg -ra',self.standby_port,self.standby_mdd)
        tinctest.logger.info("in test_inject_primary_after_promote:  gprecoverseg -ar:  %s"%stdout)

        # check if all segments are up and sync
        keyword = 'All segments are running normally'
        self.wait_till_insync_transition(activatestdby,self.standby_host,self.standby_port,self.standby_mdd, keyword, True)        
开发者ID:50wu,项目名称:gpdb,代码行数:35,代码来源:test_filerep.py

示例2: test_inject_mirror_after_promote

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
    def test_inject_mirror_after_promote(self):
        """ 
        Promote to standby, bring down mirror segments,run gprecoverseg.
        """
        tinctest.logger.info("-failover to standby, inject mirror segments, and recoverseg")
        # get standby host, port, and master data directory
        activatestdby = GpactivateStandby()
        self.standby_host = activatestdby.get_current_standby()
        self.standby_mdd = activatestdby.get_standby_dd()
        self.standby_port = activatestdby.get_standby_port()
        activatestdby.activate()   

        # inject the mirror segments from new master
        inject_cmd = 'gpfaultinjector  -f filerep_consumer  -m async -y fault -r mirror -H ALL'
        activatestdby.run_remote(self.standby_host, inject_cmd, self.standby_port, self.standby_mdd) 

        # wait till segments come up in change tracking
        self.wait_till_changetracking_transition(self.standby_host, self.standby_port)

        # recoverseg from new master
        (rc, stdout) = activatestdby.run_remote(self.standby_host,'gprecoverseg -a',self.standby_port,self.standby_mdd)
        tinctest.logger.info("in test_inject_mirror_after_promote:  gprecoverseg -a:  %s"%stdout) 

        # check if all segments are up and sync
        keyword = 'All segments are running normally'
        self.wait_till_insync_transition(activatestdby,self.standby_host,self.standby_port,self.standby_mdd,keyword, True)      
开发者ID:50wu,项目名称:gpdb,代码行数:28,代码来源:test_filerep.py

示例3: test_failover_insync

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
    def test_failover_insync(self):
        """ 
        bring down mirror segments,suspend in resync mode,failover to standby, run gprecoverseg.
        """
        tinctest.logger.info("-failover to standby in resync and recoverseg")
        # get standby host, port, and master data directory
        activatestdby = GpactivateStandby()
        self.standby_host = activatestdby.get_current_standby()
        self.standby_mdd = activatestdby.get_standby_dd()
        self.standby_port = activatestdby.get_standby_port()

        # bring down mirror segments and suspend
        Command('fault inject mirror segment', 'gpfaultinjector  -f filerep_consumer  -m async -y fault -r mirror -H ALL').run()

        # wait till segments come up in change tracking
        self.wait_till_changetracking_transition('localhost', os.environ['PGPORT'])

        Command('Injecting fault to suspend resync','gpfaultinjector -f filerep_resync -m async -y suspend -r primary -H ALL').run()
        Command('recover and suspend in insync','gprecoverseg -a').run()

        activatestdby.activate()   

        # Injecting Fault  to resume resync
        resume_resync_cmd = 'gpfaultinjector -f filerep_resync -m async -y resume -r primary -H ALL'
        activatestdby.run_remote(self.standby_host, resume_resync_cmd, self.standby_port, self.standby_mdd) 
        # Injecting Fault  to reset resync
        reset_resync_cmd = 'gpfaultinjector -f filerep_resync -m async -y reset -r primary -H ALL'
        activatestdby.run_remote(self.standby_host, reset_resync_cmd, self.standby_port, self.standby_mdd)

        # check if all segments are up and sync
        keyword = 'All segments are running normally'       
        self.wait_till_insync_transition(activatestdby,self.standby_host,self.standby_port,self.standby_mdd,keyword,True)        
开发者ID:50wu,项目名称:gpdb,代码行数:34,代码来源:test_filerep.py

示例4: start_stdby

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def start_stdby(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     stdby_dbid = self.get_standby_dbid()
     activate_stdby = GpactivateStandby()
     stdby_mdd = activate_stdby.get_standby_dd()
     stdby_port = activate_stdby.get_standby_port()
     cmd="pg_ctl -D %s -o '-p %s --gp_dbid=%s --gp_num_contents_in_cluster=2 --silent-mode=true -i -M master --gp_contentid=-1 -x 0 -E' start &"%(stdby_mdd, stdby_port, stdby_dbid)
     self.run_remote(stdby_host,cmd,stdby_port,stdby_mdd)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:11,代码来源:__init__.py

示例5: setUp

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def setUp(self):
     pgutil.check_and_start_gpdb()
     # We should forcibly recreate standby, as it might has been promoted.
     # here we need to install locally, otherwise can not run remote sql
     pgutil.remove_standby()
     pgutil.install_standby(new_stdby_host=socket.gethostname())
     gpact_stdby = GpactivateStandby()
     gpinit_stdb = GpinitStandby()
     WalReplKillProcessTestCase.stdby_port = gpact_stdby.get_standby_port()
     WalReplKillProcessTestCase.stdby_host = gpinit_stdb.get_standbyhost()
     self.standby_dir = gpact_stdby.get_standby_dd()
开发者ID:50wu,项目名称:gpdb,代码行数:13,代码来源:test_failover_recovery_mode.py

示例6: test_gpactivatestandby_on_same_host

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpactivatestandby_on_same_host(self):
     ''' Doesn't work due to STO-374'''
     gputil.install_standby(new_stdby_host='localhost')
     initstdby = GpinitStandby()
     gpact_stdby = GpactivateStandby()
     self.mdd = gpact_stdby.get_standby_dd()
     self.port = gpact_stdby.get_standby_port()
     self.standby_pid = gpact_stdby.get_standby_pid('localhost', self.port, self.mdd)
     PSQL.run_sql_file(local_path('create_tables.sql'), dbname = self.db_name)
     self.assertTrue(gpact_stdby.activate())
     self.assertTrue(gpact_stdby.verify_gpactivatestandby(self.standby_pid, 'localhost', self.port, self.mdd))
     gputil.failback_to_original_master(self.origin_mdd,socket.gethostname(),self.mdd,self.port)
开发者ID:50wu,项目名称:gpdb,代码行数:14,代码来源:test_gpactivatestandby.py

示例7: test_gpactivatestandby_on_new_host

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpactivatestandby_on_new_host(self):
     gputil.install_standby()
     initstdby = GpinitStandby()
     gpact_stdby = GpactivateStandby()
     self.mdd = gpact_stdby.get_standby_dd()
     self.host = initstdby.get_standbyhost()
     self.port = gpact_stdby.get_standby_port()
     self.standby_pid = gpact_stdby.get_standby_pid(self.host, self.port, self.mdd)
     PSQL.run_sql_file(local_path('create_tables.sql'), dbname = self.db_name)
     self.assertTrue(gpact_stdby.activate())
     self.assertTrue(gpact_stdby.verify_gpactivatestandby(self.standby_pid, self.host, self.port, self.mdd)) 
     gputil.failback_to_original_master(self.origin_mdd,self.host,self.mdd,self.port) 
开发者ID:50wu,项目名称:gpdb,代码行数:14,代码来源:test_gpactivatestandby.py

示例8: start_stdby

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def start_stdby(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     stdby_dbid = self.get_standby_dbid()
     activate_stdby = GpactivateStandby()
     stdby_mdd = activate_stdby.get_standby_dd()
     stdby_port = activate_stdby.get_standby_port()
     cmd = "pg_ctl -D %s -o '-p %s -b %s -z 2 --silent-mode=true -i -M master -C -1 -x 0 -E' start &" % (
         stdby_mdd,
         stdby_port,
         stdby_dbid,
     )
     self.run_remote(stdby_host, cmd, stdby_port, stdby_mdd)
开发者ID:kaknikhil,项目名称:gpdb,代码行数:15,代码来源:__init__.py

示例9: test_gpstop_after_failover

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpstop_after_failover(self):
     tinctest.logger.info("test gpstop from new master after failover")
     activatestdby = GpactivateStandby()
     standby_host = activatestdby.get_current_standby()
     standby_port =  activatestdby.get_standby_port()
     standby_mdd = activatestdby.get_standby_dd()
     activatestdby.activate()    
     (rc,stdout)=activatestdby.run_remote(standby_host, rmt_cmd='gpstop -a -M fast',
                                               pgport=standby_port,standbydd=standby_mdd) 
     self.assertEqual(0,rc)
     activatestdby.run_remote(standby_host, rmt_cmd='gpstart -a',
                                               pgport=standby_port,
                                               standbydd=standby_mdd)
     self.gputil.failback_to_original_master(self.origin_mdd, standby_host, standby_mdd, standby_port) 
开发者ID:50wu,项目名称:gpdb,代码行数:16,代码来源:test_gpstop.py

示例10: test_run_five

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_run_five(self):
     for i in xrange(5):
         with NewEnv(PGPORT=self.port,
                     MASTER_DATA_DIRECTORY=self.mdd):        
             pguti = GpUtility() 
             if i == 0:
                 pguti.install_standby(socket.gethostname(), self.mdd)
             # starting from second time, init standby from new master, standby_dir will be like  master_newstandby_newstandby...
             else:
                 pguti.install_standby(socket.gethostname(), os.path.join(self.mdd,'newstandby'))
             gpact = GpactivateStandby()
             self.mdd = gpact.get_standby_dd()
             self.port = gpact.get_standby_port()
             gpact.activate()
             tinctest.logger.info("self.mdd is %s, self.port is %s"%(self.mdd, self.port))
开发者ID:50wu,项目名称:gpdb,代码行数:17,代码来源:test_5times.py

示例11: test_gpactivatestandby_new_host_with_filespace

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpactivatestandby_new_host_with_filespace(self):
     from mpp.lib.gpfilespace import Gpfilespace
     gpfile = Gpfilespace()
     gpfile.create_filespace('fs_walrepl_a')
     PSQL.run_sql_file(local_path('filespace.sql'), dbname= self.db_name)
     gputil.install_standby()
     initstdby = GpinitStandby()
     gpact_stdby = GpactivateStandby()
     self.mdd = gpact_stdby.get_standby_dd()
     self.host = initstdby.get_standbyhost()
     self.port = gpact_stdby.get_standby_port()
     self.standby_pid = gpact_stdby.get_standby_pid(self.host, self.port, self.mdd)
     PSQL.run_sql_file(local_path('create_tables.sql'), dbname = self.db_name)
     self.assertTrue(gpact_stdby.activate())
     self.assertTrue(gpact_stdby.verify_gpactivatestandby(self.standby_pid, self.host, self.port, self.mdd)) 
     gputil.failback_to_original_master(self.origin_mdd,self.host,self.mdd,self.port)
开发者ID:50wu,项目名称:gpdb,代码行数:18,代码来源:test_gpactivatestandby.py

示例12: test_promote_incomplete_stdby

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_promote_incomplete_stdby(self):
     ''' 
     remove the standby base dir, try promote and check if fail       
     '''
     gpactivate_stdby = GpactivateStandby()
     gpinit_stdby = GpinitStandby()
     stdby_mdd = gpactivate_stdby.get_standby_dd()
     stdby_host = gpinit_stdby.get_standbyhost()
     stdby_port = gpactivate_stdby.get_standby_port()
     destDir = os.path.join(stdby_mdd, 'base')
     self.pgutil.clean_dir(stdby_host,destDir)
     promote_cmd = "pg_ctl promote -D %s"%stdby_mdd       
     (rc, output) = gpactivate_stdby.run_remote(stdby_host,promote_cmd ,stdby_port,stdby_mdd)
     self.assertEqual(rc, 0)
     pid = self.pgutil.get_pid_by_keyword(host=stdby_host, pgport=stdby_port, keyword='master', option='bin')
     self.assertTrue(int(pid) == -1, 'incomplete standby data directory promote succeeds.')
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:18,代码来源:test_promote_negative.py

示例13: test_gpstart_master_after_failover

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpstart_master_after_failover(self):
     """
     failover, start from new master, then recover the cluster back to
     have the old master active.
     """
     tinctest.logger.info("failover, and run gpstart master test")
     self.gputil.check_and_start_gpdb()
     activatestdby = GpactivateStandby()
     standby_host = activatestdby.get_current_standby()
     standby_mdd = activatestdby.get_standby_dd()
     standby_port = activatestdby.get_standby_port()
     activatestdby.activate()
     self.stdby._run_remote_command(standby_host, command = 'gpstop -a')
     stdout = self.stdby._run_remote_command(standby_host,command = 'gpstart -a')
     self.assertNotRegexpMatches(stdout,"FATAL","ERROR")
     self.assertTrue(self.gputil.gpstart_and_verify(master_dd = standby_mdd, host = standby_host))
     self.gputil.failback_to_original_master(self.origin_mdd, standby_host, standby_mdd, standby_port)
开发者ID:50wu,项目名称:gpdb,代码行数:19,代码来源:test_gpstart.py

示例14: test_gpstart_original_master_after_promote

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
    def test_gpstart_original_master_after_promote(self):
        """
        failover, start from new master, then recover the cluster back to
        have the old master active.
        """
        tinctest.logger.info("activate and run gpstart for original master")
        activatestdby = GpactivateStandby()
        standby_host = activatestdby.get_current_standby()
        standby_mdd = activatestdby.get_standby_dd()
        standby_port = activatestdby.get_standby_port()
        activatestdby.activate()
        (rc, stdout) = self.gputil.run('gpstart -a -v')
	self.gputil.run('pg_controldata %s' % self.origin_mdd)
	self.stdby._run_remote_command(standby_host, command = 'pg_controldata %s' % standby_mdd)
        self.assertNotEqual(rc, 0)
        # This below error message comes from gpstart product code (if its modified change it here as well.)
        self.assertRegexpMatches(stdout,"Standby activated, this node no more can act as master.")
        self.gputil.failback_to_original_master(self.origin_mdd, standby_host, standby_mdd, standby_port)
开发者ID:50wu,项目名称:gpdb,代码行数:20,代码来源:test_gpstart.py

示例15: test_gpstart_master_only_after_failover

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby import GpactivateStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby import get_standby_dd [as 别名]
 def test_gpstart_master_only_after_failover(self):
     """
     for test purpose, failing back to old master should
           remove standby from primary after activate standby
     """
     tinctest.logger.info("start master only with -m option after failover")
     activatestdby = GpactivateStandby()
     standby_host = activatestdby.get_current_standby()
     standby_mdd = activatestdby.get_standby_dd()
     standby_port = activatestdby.get_standby_port()
     activatestdby.activate()
     self.stdby._run_remote_command(standby_host,command = 'gpstop -a')
     stdout = self.stdby._run_remote_command(standby_host,command = 'export  GPSTART_INTERNAL_MASTER_ONLY=1; gpstart -a -m')
     self.assertNotRegexpMatches(stdout,"ERROR","Start master only after failover failed")
     self.assertTrue(self.gputil.gpstart_and_verify(master_dd = standby_mdd, host = standby_host))
     self.stdby._run_remote_command(standby_host,command = 'gpstop -a -m')
     self.gputil.run(command = 'gpstop -ar')
     self.gputil.failback_to_original_master(self.origin_mdd, standby_host, standby_mdd, standby_port)
开发者ID:50wu,项目名称:gpdb,代码行数:20,代码来源:test_gpstart.py


注:本文中的mpp.gpdb.tests.storage.walrepl.gpactivatestandby.GpactivateStandby.get_standby_dd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。