Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Incubator Pegasus
提交
695ad274
Incubator Pegasus
项目概览
apache
/
Incubator Pegasus
通知
9
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Incubator Pegasus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
695ad274
编写于
8月 22, 2019
作者:
Q
QinZuoyan
提交者:
GitHub
8月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: improve shell get_app_stat and ls_nodes & fix scripts (#382)
上级
b0bd9f52
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
25 deletion
+31
-25
scripts/clusters_show.sh
scripts/clusters_show.sh
+10
-4
scripts/pegasus_manual_compact.sh
scripts/pegasus_manual_compact.sh
+4
-4
scripts/pegasus_replica_thread.sh
scripts/pegasus_replica_thread.sh
+2
-2
scripts/pegasus_set_usage_scenario.sh
scripts/pegasus_set_usage_scenario.sh
+2
-2
src/shell/command_helper.h
src/shell/command_helper.h
+6
-5
src/shell/commands/node_management.cpp
src/shell/commands/node_management.cpp
+7
-8
未找到文件。
scripts/clusters_show.sh
浏览文件 @
695ad274
...
@@ -11,6 +11,7 @@ if [ $# -lt 2 ]; then
...
@@ -11,6 +11,7 @@ if [ $# -lt 2 ]; then
exit
1
exit
1
fi
fi
PID
=
$$
clusters_file
=
$1
clusters_file
=
$1
format
=
$2
format
=
$2
if
[
"
$format
"
!=
"table"
-a
"
$format
"
!=
"csv"
]
;
then
if
[
"
$format
"
!=
"table"
-a
"
$format
"
!=
"csv"
]
;
then
...
@@ -49,8 +50,8 @@ while read cluster
...
@@ -49,8 +50,8 @@ while read cluster
do
do
tmp_file
=
"/tmp/
$UID
.
$PID
.pegasus.clusters_status.cluster_info"
tmp_file
=
"/tmp/
$UID
.
$PID
.pegasus.clusters_status.cluster_info"
echo
"cluster_info"
| ./run.sh shell
-n
$cluster
&>
$tmp_file
echo
"cluster_info"
| ./run.sh shell
-n
$cluster
&>
$tmp_file
cluster_info_
ok
=
`
grep
"succeed
"
$tmp_file
|
wc
-l
`
cluster_info_
fail
=
`
grep
"
\<
failed
\>
"
$tmp_file
|
wc
-l
`
if
[
$cluster_info_
ok
-ne
1
]
;
then
if
[
$cluster_info_
fail
-eq
1
]
;
then
echo
"ERROR: get cluster info failed, refer error to
$tmp_file
"
echo
"ERROR: get cluster info failed, refer error to
$tmp_file
"
exit
1
exit
1
fi
fi
...
@@ -71,8 +72,13 @@ do
...
@@ -71,8 +72,13 @@ do
echo
"app_stat -o
$app_stat_result
"
| ./run.sh shell
-n
$cluster
&>
$tmp_file
echo
"app_stat -o
$app_stat_result
"
| ./run.sh shell
-n
$cluster
&>
$tmp_file
app_stat_fail
=
`
grep
"
\<
failed
\>
"
$tmp_file
|
wc
-l
`
app_stat_fail
=
`
grep
"
\<
failed
\>
"
$tmp_file
|
wc
-l
`
if
[
$app_stat_fail
-eq
1
]
;
then
if
[
$app_stat_fail
-eq
1
]
;
then
echo
"ERROR: app stat failed, refer error to
$tmp_file
"
sleep
1
exit
1
echo
"app_stat -o
$app_stat_result
"
| ./run.sh shell
-n
$cluster
&>
$tmp_file
app_stat_fail
=
`
grep
"
\<
failed
\>
"
$tmp_file
|
wc
-l
`
if
[
$app_stat_fail
-eq
1
]
;
then
echo
"ERROR: app stat failed, refer error to
$tmp_file
"
exit
1
fi
fi
fi
app_count
=
`
cat
$app_stat_result
|
wc
-l
`
app_count
=
`
cat
$app_stat_result
|
wc
-l
`
app_count
=
$((
app_count-2
))
app_count
=
$((
app_count-2
))
...
...
scripts/pegasus_manual_compact.sh
浏览文件 @
695ad274
...
@@ -58,8 +58,8 @@ function get_env()
...
@@ -58,8 +58,8 @@ function get_env()
log_file
=
"/tmp/
$UID
.
$PID
.pegasus.get_app_envs.
${
app_name
}
"
log_file
=
"/tmp/
$UID
.
$PID
.pegasus.get_app_envs.
${
app_name
}
"
echo
-e
"use
${
app_name
}
\n
get_app_envs"
| ./run.sh shell
--cluster
${
cluster
}
&>
${
log_file
}
echo
-e
"use
${
app_name
}
\n
get_app_envs"
| ./run.sh shell
--cluster
${
cluster
}
&>
${
log_file
}
get_
ok
=
`
grep
'get app envs succe
ed'
${
log_file
}
|
wc
-l
`
get_
fail
=
`
grep
'get app env fail
ed'
${
log_file
}
|
wc
-l
`
if
[
${
get_
ok
}
-ne
1
]
;
then
if
[
${
get_
fail
}
-eq
1
]
;
then
echo
"ERROR: get app envs failed, refer to
${
log_file
}
"
echo
"ERROR: get app envs failed, refer to
${
log_file
}
"
exit
1
exit
1
fi
fi
...
@@ -77,8 +77,8 @@ function set_env()
...
@@ -77,8 +77,8 @@ function set_env()
echo
"set_app_envs
${
key
}
=
${
value
}
"
echo
"set_app_envs
${
key
}
=
${
value
}
"
log_file
=
"/tmp/
$UID
.
$PID
.pegasus.set_app_envs.
${
app_name
}
"
log_file
=
"/tmp/
$UID
.
$PID
.pegasus.set_app_envs.
${
app_name
}
"
echo
-e
"use
${
app_name
}
\n
set_app_envs
${
key
}
${
value
}
"
| ./run.sh shell
--cluster
${
cluster
}
&>
${
log_file
}
echo
-e
"use
${
app_name
}
\n
set_app_envs
${
key
}
${
value
}
"
| ./run.sh shell
--cluster
${
cluster
}
&>
${
log_file
}
set_
ok
=
`
grep
'set app envs succe
ed'
${
log_file
}
|
wc
-l
`
set_
fail
=
`
grep
'set app env fail
ed'
${
log_file
}
|
wc
-l
`
if
[
${
set_
ok
}
-ne
1
]
;
then
if
[
${
set_
fail
}
-eq
1
]
;
then
echo
"ERROR: set app envs failed, refer to
${
log_file
}
"
echo
"ERROR: set app envs failed, refer to
${
log_file
}
"
exit
1
exit
1
fi
fi
...
...
scripts/pegasus_replica_thread.sh
浏览文件 @
695ad274
...
@@ -27,8 +27,8 @@ all_start_time=$((`date +%s`))
...
@@ -27,8 +27,8 @@ all_start_time=$((`date +%s`))
echo
echo
echo
"app
$app_name
-d"
| ./run.sh shell
--cluster
$cluster
&>/tmp/
$UID
.
$PID
.pegasus.app.
$app_name
echo
"app
$app_name
-d"
| ./run.sh shell
--cluster
$cluster
&>/tmp/
$UID
.
$PID
.pegasus.app.
$app_name
list_
ok
=
`
grep
"list app
$app_name
succeed
"
/tmp/
$UID
.
$PID
.pegasus.app.
$app_name
|
wc
-l
`
list_
fail
=
`
grep
"
\<
failed
\>
"
/tmp/
$UID
.
$PID
.pegasus.app.
$app_name
|
wc
-l
`
if
[
$list_
ok
-ne
1
]
;
then
if
[
$list_
fail
-eq
1
]
;
then
grep
ERR /tmp/
$UID
.
$PID
.pegasus.app.
$app_name
grep
ERR /tmp/
$UID
.
$PID
.pegasus.app.
$app_name
echo
"ERROR: list app failed, refer to /tmp/
$UID
.
$PID
.pegasus.app.
$app_name
"
echo
"ERROR: list app failed, refer to /tmp/
$UID
.
$PID
.pegasus.app.
$app_name
"
exit
1
exit
1
...
...
scripts/pegasus_set_usage_scenario.sh
浏览文件 @
695ad274
...
@@ -33,8 +33,8 @@ all_start_time=$((`date +%s`))
...
@@ -33,8 +33,8 @@ all_start_time=$((`date +%s`))
echo
echo
echo
-e
"use
$app_name
\n
set_app_envs
$scenario_key
$scenario
"
| ./run.sh shell
--cluster
$cluster
&>/tmp/
$UID
.
$PID
.pegasus.set_app_envs
echo
-e
"use
$app_name
\n
set_app_envs
$scenario_key
$scenario
"
| ./run.sh shell
--cluster
$cluster
&>/tmp/
$UID
.
$PID
.pegasus.set_app_envs
set_
ok
=
`
grep
'set app envs succe
ed'
/tmp/
$UID
.
$PID
.pegasus.set_app_envs |
wc
-l
`
set_
fail
=
`
grep
'set app env fail
ed'
/tmp/
$UID
.
$PID
.pegasus.set_app_envs |
wc
-l
`
if
[
$set_
ok
-ne
1
]
;
then
if
[
$set_
fail
-eq
1
]
;
then
grep
ERR /tmp/
$UID
.
$PID
.pegasus.set_app_envs
grep
ERR /tmp/
$UID
.
$PID
.pegasus.set_app_envs
echo
"ERROR: set app envs failed, refer to /tmp/
$UID
.
$PID
.pegasus.set_app_envs"
echo
"ERROR: set app envs failed, refer to /tmp/
$UID
.
$PID
.pegasus.set_app_envs"
exit
1
exit
1
...
...
src/shell/command_helper.h
浏览文件 @
695ad274
...
@@ -680,12 +680,13 @@ get_app_stat(shell_context *sc, const std::string &app_name, std::vector<row_dat
...
@@ -680,12 +680,13 @@ get_app_stat(shell_context *sc, const std::string &app_name, std::vector<row_dat
}
}
::
dsn
::
command
command
;
::
dsn
::
command
command
;
command
.
cmd
=
"perf-counters
-by-substr
"
;
command
.
cmd
=
"perf-counters"
;
char
tmp
[
256
];
char
tmp
[
256
];
if
(
app_name
.
empty
())
if
(
app_name
.
empty
())
{
sprintf
(
tmp
,
"@"
);
sprintf
(
tmp
,
".*@.*"
);
else
}
else
{
sprintf
(
tmp
,
"@%d."
,
app_info
->
app_id
);
sprintf
(
tmp
,
".*@%d
\\
..*"
,
app_info
->
app_id
);
}
command
.
arguments
.
emplace_back
(
tmp
);
command
.
arguments
.
emplace_back
(
tmp
);
std
::
vector
<
std
::
pair
<
bool
,
std
::
string
>>
results
;
std
::
vector
<
std
::
pair
<
bool
,
std
::
string
>>
results
;
call_remote_command
(
sc
,
nodes
,
command
,
results
);
call_remote_command
(
sc
,
nodes
,
command
,
results
);
...
...
src/shell/commands/node_management.cpp
浏览文件 @
695ad274
...
@@ -171,7 +171,7 @@ bool ls_nodes(command_executor *e, shell_context *sc, arguments args)
...
@@ -171,7 +171,7 @@ bool ls_nodes(command_executor *e, shell_context *sc, arguments args)
if
(
resource_usage
)
{
if
(
resource_usage
)
{
std
::
vector
<
node_desc
>
nodes
;
std
::
vector
<
node_desc
>
nodes
;
if
(
!
fill_nodes
(
sc
,
"replica-server"
,
nodes
))
{
if
(
!
fill_nodes
(
sc
,
"replica-server"
,
nodes
))
{
derror
(
"get replica server node list failed"
)
;
std
::
cout
<<
"get replica server node list failed"
<<
std
::
endl
;
return
true
;
return
true
;
}
}
...
@@ -192,21 +192,20 @@ bool ls_nodes(command_executor *e, shell_context *sc, arguments args)
...
@@ -192,21 +192,20 @@ bool ls_nodes(command_executor *e, shell_context *sc, arguments args)
if
(
tmp_it
==
tmp_map
.
end
())
if
(
tmp_it
==
tmp_map
.
end
())
continue
;
continue
;
if
(
!
results
[
i
].
first
)
{
if
(
!
results
[
i
].
first
)
{
derror
(
"query perf counter info from node %s failed"
,
node_addr
.
to_string
());
std
::
cout
<<
"query perf counter info from node "
<<
node_addr
.
to_string
()
<<
" failed"
<<
std
::
endl
;
return
true
;
return
true
;
}
}
dsn
::
perf_counter_info
info
;
dsn
::
perf_counter_info
info
;
dsn
::
blob
bb
(
results
[
i
].
second
.
data
(),
0
,
results
[
i
].
second
.
size
());
dsn
::
blob
bb
(
results
[
i
].
second
.
data
(),
0
,
results
[
i
].
second
.
size
());
if
(
!
dsn
::
json
::
json_forwarder
<
dsn
::
perf_counter_info
>::
decode
(
bb
,
info
))
{
if
(
!
dsn
::
json
::
json_forwarder
<
dsn
::
perf_counter_info
>::
decode
(
bb
,
info
))
{
derror
(
"decode perf counter info from node %s failed, result = %s"
,
std
::
cout
<<
"decode perf counter info from node "
<<
node_addr
.
to_string
()
node_addr
.
to_string
(),
<<
" failed, result = "
<<
results
[
i
].
second
<<
std
::
endl
;
results
[
i
].
second
.
c_str
());
return
true
;
return
true
;
}
}
if
(
info
.
result
!=
"OK"
)
{
if
(
info
.
result
!=
"OK"
)
{
derror
(
"query perf counter info from node %s returns error, error = %s"
,
std
::
cout
<<
"query perf counter info from node "
<<
node_addr
.
to_string
()
node_addr
.
to_string
(),
<<
" returns error, error = "
<<
info
.
result
<<
std
::
endl
;
info
.
result
.
c_str
());
return
true
;
return
true
;
}
}
list_nodes_helper
&
h
=
tmp_it
->
second
;
list_nodes_helper
&
h
=
tmp_it
->
second
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录