Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
OpenAtomFoundation
pika
提交
0d8d7764
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,发现更多精彩内容 >>
提交
0d8d7764
编写于
8月 01, 2016
作者:
K
KernelMaker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1) binlog_sync use random port; 2) set FLAGS_logbufsecs = 0; 3) 2.1.1
上级
9a5714c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
10 deletion
+16
-10
include/pika_define.h
include/pika_define.h
+1
-1
src/pika.cc
src/pika.cc
+2
-0
tools/binlog_sync/main.cc
tools/binlog_sync/main.cc
+13
-9
未找到文件。
include/pika_define.h
浏览文件 @
0d8d7764
...
...
@@ -5,7 +5,7 @@
#define PIKA_MAX_WORKER_THREAD_NUM 24
const
std
::
string
kPikaVersion
=
"2.1.
0
"
;
const
std
::
string
kPikaVersion
=
"2.1.
1
"
;
const
std
::
string
kPikaPidFile
=
"pika.pid"
;
struct
ClientInfo
{
...
...
src/pika.cc
浏览文件 @
0d8d7764
...
...
@@ -37,6 +37,7 @@ static void PikaGlogInit() {
FLAGS_log_dir
=
g_pika_conf
->
log_path
();
FLAGS_minloglevel
=
g_pika_conf
->
log_level
();
FLAGS_max_log_size
=
1800
;
FLAGS_logbufsecs
=
0
;
::
google
::
InitGoogleLogging
(
"pika"
);
}
...
...
@@ -84,6 +85,7 @@ static void PikaSignalSetup() {
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGINT
,
&
IntSigHandle
);
signal
(
SIGQUIT
,
&
IntSigHandle
);
signal
(
SIGTERM
,
&
IntSigHandle
);
}
static
void
usage
()
...
...
tools/binlog_sync/main.cc
浏览文件 @
0d8d7764
#include <glog/logging.h>
#include <random>
#include "binlog_sync.h"
...
...
@@ -15,6 +16,7 @@ static void GlogInit(std::string& log_path, bool is_daemon) {
FLAGS_log_dir
=
log_path
;
FLAGS_minloglevel
=
0
;
FLAGS_max_log_size
=
1800
;
FLAGS_logbufsecs
=
0
;
::
google
::
InitGoogleLogging
(
"BinlogSync"
);
}
...
...
@@ -62,6 +64,7 @@ static void SignalSetup() {
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGINT
,
&
IntSigHandle
);
signal
(
SIGQUIT
,
&
IntSigHandle
);
signal
(
SIGTERM
,
&
IntSigHandle
);
}
static
void
Usage
()
...
...
@@ -69,15 +72,14 @@ static void Usage()
fprintf
(
stderr
,
"Usage: binlog_sync [-h] [-p local_port -i master_ip -o master_port -f filenum -s offset -w password -l log_path]
\n
"
"
\t
-h -- show this help
\n
"
"
\t
-p -- local port(REQUIRED)
\n
"
"
\t
-i -- master ip(OPTIONAL default: 127.0.0.1)
\n
"
"
\t
-
o
-- master port(REQUIRED)
\n
"
"
\t
-
p
-- master port(REQUIRED)
\n
"
"
\t
-f -- binlog filenum(OPTIONAL default: local offset)
\n
"
"
\t
-s -- binlog offset(OPTIONAL default: local offset)
\n
"
"
\t
-w -- password for master(OPTIONAL)
\n
"
"
\t
-l -- local log path(OPTIONAL default: ./log)
\n
"
"
\t
-d -- daemonize(OPTIONAL)
\n
"
" example: ./binlog_sync -
p 9222 -i 127.0.0.1 -o
9221 -f 0 -s 0 -w abc -l ./log -d
\n
"
" example: ./binlog_sync -
i 127.0.0.1 -p
9221 -f 0 -s 0 -w abc -l ./log -d
\n
"
);
}
...
...
@@ -99,17 +101,13 @@ int main(int argc, char *argv[]) {
std
::
string
log_path
=
"./log/"
;
bool
is_daemon
=
false
;
// std::cout << src_port << " " << dest_host << " " << dest_port << " " << filenum << " " << offset << " " << passwd << std::endl;
while
(
-
1
!=
(
c
=
getopt
(
argc
,
argv
,
"
p:i:o
:f:s:w:l:dh"
)))
{
while
(
-
1
!=
(
c
=
getopt
(
argc
,
argv
,
"
i:p
:f:s:w:l:dh"
)))
{
switch
(
c
)
{
case
'p'
:
snprintf
(
buf
,
1024
,
"%s"
,
optarg
);
slash
::
string2l
(
buf
,
strlen
(
buf
),
&
src_port
);
break
;
case
'i'
:
snprintf
(
buf
,
1024
,
"%s"
,
optarg
);
dest_host
=
std
::
string
(
buf
);
break
;
case
'
o
'
:
case
'
p
'
:
snprintf
(
buf
,
1024
,
"%s"
,
optarg
);
slash
::
string2l
(
buf
,
strlen
(
buf
),
&
dest_port
);
break
;
...
...
@@ -144,6 +142,12 @@ int main(int argc, char *argv[]) {
}
}
std
::
random_device
rd
;
std
::
mt19937
mt
(
rd
());
std
::
uniform_int_distribution
<
int
>
di
(
10000
,
60000
);
src_port
=
di
(
mt
);
LOG
(
INFO
)
<<
"Use random port: "
<<
src_port
;
//std::cout << src_port << " " << dest_host << " " << dest_port << " " << filenum << " " << offset << " " << passwd << " " << log_path << std::endl;
if
(
src_port
==
-
1
||
dest_port
==
-
1
)
{
fprintf
(
stderr
,
"Invalid Arguments
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录