Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
77a93f43
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77a93f43
编写于
7月 06, 2018
作者:
C
Chris Hajas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove gpgetconfig.py
Authored-by:
N
Chris Hajas
<
chajas@pivotal.io
>
上级
c4a7b251
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
121 deletion
+0
-121
gpAux/releng/NON_PRODUCTION_FILES.txt
gpAux/releng/NON_PRODUCTION_FILES.txt
+0
-1
gpAux/releng/QAUTILS_FILES.txt
gpAux/releng/QAUTILS_FILES.txt
+0
-1
gpMgmt/bin/lib/gpgetconfig.py
gpMgmt/bin/lib/gpgetconfig.py
+0
-119
未找到文件。
gpAux/releng/NON_PRODUCTION_FILES.txt
浏览文件 @
77a93f43
...
...
@@ -3,7 +3,6 @@ bin/explain.pm
bin/gpaddmirrors
bin/gpfaultinjector
bin/gptorment.pl
bin/lib/gpgetconfig.py
bin/lib/gptest.py
bin/pgbench
bin/postgresql_conf_gp_additions
...
...
gpAux/releng/QAUTILS_FILES.txt
浏览文件 @
77a93f43
...
...
@@ -2,7 +2,6 @@ bin/explain.pl
bin/explain.pm
bin/gpfaultinjector
bin/gptorment.pl
bin/lib/gpgetconfig.py
bin/pgbench
bin/run_operator_tests.pl
lib/python/gppylib/programs/clsInjectFault.py
gpMgmt/bin/lib/gpgetconfig.py
已删除
100644 → 0
浏览文件 @
c4a7b251
#!/usr/bin/env python
'''
gpgetconfig -- obtain gp_configuration
Usage: gpgetconfig [-f] [-u user] -d master_data_directory
-f : if necessary, force start up and shutdown of DB to obtain configuration
Exit: 0 - no error
1 - misc error
2 - unable to connect to database
'''
import
os
,
sys
os
.
putenv
(
'PGHOST'
,
''
)
os
.
putenv
(
"PGOPTIONS"
,
'-c gp_session_role=utility'
)
os
.
putenv
(
'PGDATABASE'
,
'template1'
)
class
__globals__
:
opt
=
{}
for
o
in
'ud'
:
opt
[
'-'
+
o
]
=
''
for
o
in
'f'
:
opt
[
'-'
+
o
]
=
False
GV
=
__globals__
()
############
def
usage
(
exitarg
):
print
__doc__
sys
.
exit
(
exitarg
)
############
def
parseCommandLine
():
import
getopt
try
:
(
options
,
args
)
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'?fu:d:'
)
except
Exception
,
e
:
sys
.
stderr
.
write
(
'Error: %s
\n
'
%
str
(
e
))
usage
(
1
)
for
(
switch
,
val
)
in
options
:
if
switch
==
'-?'
:
usage
(
0
)
elif
switch
[
1
]
in
'ud'
:
GV
.
opt
[
switch
]
=
val
elif
switch
[
1
]
in
'f'
:
GV
.
opt
[
switch
]
=
True
if
not
GV
.
opt
[
'-d'
]:
usage
(
'Error: missing -d param'
)
############
def
setPort
():
port
=
0
f
=
None
try
:
f
=
open
(
os
.
path
.
join
(
GV
.
opt
[
'-d'
],
'postgresql.conf'
))
lines
=
f
.
readlines
()
lines
=
map
(
lambda
x
:
x
.
strip
().
split
(
'='
),
lines
)
lines
=
filter
(
lambda
x
:
len
(
x
)
and
x
[
0
]
==
'port'
,
lines
)
port
=
int
(
(
lines
[
0
][
1
].
split
())
[
0
])
except
Exception
,
e
:
pass
finally
:
if
f
:
f
.
close
()
if
port
==
0
:
sys
.
stderr
.
write
(
'Error: unable to read port number from %s/postgresql.conf'
%
GV
.
opt
[
'-d'
])
sys
.
exit
(
1
)
os
.
putenv
(
'PGPORT'
,
str
(
port
))
############
def
getConfiguration
():
CMD
=
"""psql -At -q -c "select content, preferred_role='p' as definedprimary, dbid, role = 'p' as isprimary, 't' as valid, hostname, port,
\
datadir from gp_segment_configuration" 2> /dev/null"""
p
=
os
.
popen
(
CMD
)
out
=
p
.
readlines
()
rc
=
p
.
close
()
return
(
rc
,
out
)
############
def
main
():
parseCommandLine
()
if
GV
.
opt
[
'-u'
]:
os
.
putenv
(
'PGUSER'
,
GV
.
opt
[
'-u'
])
os
.
putenv
(
'MASTER_DATA_DIRECTORY'
,
GV
.
opt
[
'-d'
])
setPort
()
(
rc
,
out
)
=
getConfiguration
()
if
rc
:
if
not
GV
.
opt
[
'-f'
]:
sys
.
stderr
.
write
(
'Error: psql unable to connect
\n
'
)
sys
.
exit
(
2
)
os
.
putenv
(
'GPSTART_INTERNAL_MASTER_ONLY'
,
'1'
)
p
=
os
.
popen
(
"gpstart -m"
)
p
.
readlines
()
p
.
close
()
(
rc
,
out
)
=
getConfiguration
()
p
=
os
.
popen
(
"gpstop -m"
)
p
.
readlines
()
p
.
close
()
if
rc
:
sys
.
stderr
.
write
(
'Error: psql still unable to connect after bouncing
\n
'
)
sys
.
exit
(
1
)
out
=
filter
(
lambda
x
:
x
,
map
(
lambda
x
:
x
.
strip
(),
out
))
for
line
in
out
:
print
'[gpgetconfig]'
,
line
if
__name__
==
'__main__'
:
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录