zoukankan      html  css  js  c++  java
  • Greenplum 如何直连segment节点

     
    展开阅读全文
    直连greenplum segment节点的方法, utility模式 : 
    使用这种方式,不与其他节点通讯,只操作当前节点。也没有数据分布的概念。
    如果使用utility模式连接的是master节点,写入数据时,数据不会分布到segment,使用正常模式连接后,写入master的数据也查不出来。
    
    $  PGOPTIONS='-c gp_session_role=utility' psql -p 40005
    psql (8.2.15)
    Type "help" for help.
    
    postgres=# dt
                 List of relations
     Schema | Name | Type  |  Owner   | Storage 
    --------+------+-------+----------+---------
     public | t    | table | digoal | heap
     public | test | table | digoal | heap
    (2 rows)
    
    postgres=# select * from pg_locks;
       locktype    | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction |  pid   |      mode       | granted | mppsessionid | mppiswriter | gp_segment_id 
    ---------------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+--------+-----------------+---------+--------------+-------------+---------------
     transactionid |          |          |      |       |        136604 |         |       |          |      136604 | 130724 | ExclusiveLock   | t       |            6 | t           |            -1
     relation      |    10899 |    10333 |      |       |               |         |       |          |      136604 | 130724 | AccessShareLock | t       |            6 | t           |            -1
    (2 rows)
    
    注意使用PGOPTIONS='-c gp_session_role=utility'后,只操作本地节点
    
    $psql -p # master
    psql (8.2.15)
    Type "help" for help.
    postgres=# select count(*) from test;
     count 
    -------
         0
    (1 row)
    postgres=# q
    
    
    $psql -p 40001 # segment
    psql (8.2.15)
    Type "help" for help.
    postgres=# select count(*) from test;
      count  
    ---------
     4166801
    (1 row)
  • 相关阅读:
    Pyspider实例之抓取数据并保存到MySQL的数据库
    pyspider中内容选择器常用方法汇总
    pyspider用PyQuery解析页面数据
    CasperJs 入门介绍
    移动应用抓包调试利器Charles
    GO语言文件的创建与打开实例分析
    Golang之实现一个负载均衡算法(随机,轮询)
    重新认识一个强大的 Gson
    关于Java的File.separator
    centos重启redis后,数据丢失
  • 原文地址:https://www.cnblogs.com/xibuhaohao/p/11119169.html
Copyright © 2011-2022 走看看