Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
OpenAtomFoundation
pika
提交
a1329f92
pika
项目概览
镜像
/
OpenAtomFoundation
/
pika
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
pika
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a1329f92
编写于
7月 21, 2016
作者:
W
wenduo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
binlog_sender add auth
上级
baa293c7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
3 deletion
+22
-3
tools/binlog_tools/binlog_sender.cc
tools/binlog_tools/binlog_sender.cc
+22
-3
未找到文件。
tools/binlog_tools/binlog_sender.cc
浏览文件 @
a1329f92
...
...
@@ -15,18 +15,19 @@
static
void
Usage
()
{
fprintf
(
stderr
,
"Usage: binlogsender [-h] [-
c old2new -i input_path -o output_path -f filenumber -t offset
]
\n
"
"Usage: binlogsender [-h] [-
t old/new -a password -i ip -p port -n input -f filenumber -s starttime -e endtime
]
\n
"
"
\t
Binlog_sender reads from pika's binlog and send to pika/redis server
\n
"
"
\t
You can specify a unixtime because pika's new binlog(later than 2.1.0) is timestamped.
\n
"
"
\t
You can build a new pika back to any timepoint with this tool, let's rock and roll!
\n
"
"
\t
-h -- show this help
\n
"
"
\t
-a -- password for pika server
\n
"
"
\t
-t -- log type:old or new
\n
"
"
\t
-i -- ip of pika server
\n
"
"
\t
-p -- port of pika server
\n
"
"
\t
-n -- path of input binlog files , default: ./old_log/
\n
"
"
\t
-f -- files to send, default: 0
\n
"
"
\t
-s -- start time , default: '2001-00-00 00:59:01'
\n
"
"
\t
-e --
start
time , default: '2100-01-30 24:00:01'
\n
"
"
\t
-e --
end
time , default: '2100-01-30 24:00:01'
\n
"
" example: ./binlog_sender -n /data2/wangwenduo/newlog/ -t new -i 127.0.0.1 -p 10221 -s '2001-10-11 11:11:11' -e '2020-12-11 11:11:11' -f 526,527
\n
"
);
...
...
@@ -69,6 +70,7 @@ int main(int argc, char *argv[]) {
exit
(
-
1
);
}
std
::
string
passwd
;
std
::
string
input_path
=
"./old_log/"
;
std
::
string
ip
=
"127.0.0.1"
;
int
port
=
6279
;
...
...
@@ -78,6 +80,7 @@ int main(int argc, char *argv[]) {
std
::
string
end_time_str
=
"2100-01-30 24:00:01"
;
// for correct inputs , we use these flags to generate warning to user
bool
use_passwd
=
false
;
bool
default_input_path
=
true
;
bool
default_ip
=
true
;
bool
default_port
=
true
;
...
...
@@ -86,11 +89,15 @@ int main(int argc, char *argv[]) {
bool
default_start_time
=
true
;
bool
default_end_time
=
true
;
char
c
;
while
(
-
1
!=
(
c
=
getopt
(
argc
,
argv
,
"hn:i:p:t:f:s:e:"
)))
{
while
(
-
1
!=
(
c
=
getopt
(
argc
,
argv
,
"hn:i:p:t:f:s:e:
a:
"
)))
{
switch
(
c
)
{
case
'h'
:
Usage
();
exit
(
-
1
);
case
'a'
:
passwd
=
optarg
;
use_passwd
=
true
;
break
;
case
'n'
:
input_path
=
optarg
;
default_input_path
=
false
;
...
...
@@ -187,6 +194,18 @@ int main(int argc, char *argv[]) {
exit
(
-
1
);
}
if
(
use_passwd
)
{
std
::
string
auth_str
;
auth_str
=
"*2
\r\n
$4
\r\n
auth
\r\n
$"
;
auth_str
.
append
(
std
::
to_string
(
passwd
.
size
()));
auth_str
.
append
(
"
\r\n
"
);
auth_str
.
append
(
passwd
);
auth_str
.
append
(
"
\r\n
"
);
pink_s
=
rcli
->
Send
(
&
auth_str
);
pink_s
=
rcli
->
Recv
(
NULL
);
}
std
::
string
scratch
;
scratch
.
reserve
(
1024
*
1024
);
int
finished_num
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录