FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/tools/redis_copy.php at master · haroldphp/framework · GitHub
haroldphp
framework
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
tools
/
redis_copy.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (23 loc) · 837 Bytes
Breadcrumbs
framework
/
tools
/
redis_copy.php
Copy path
File metadata and controls
25 lines (23 loc) · 837 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
* 此工具主要是从Redis的AOF备份文件的数据同步到另外一台Redis机器
* 支持热同步,数据复制完毕后,来源Redis如果有写入,仍然会继续同步到新服务器(必须关闭Redis的AOF压缩特性)
* 暂时不支持断点续传,请勿强杀此进程
*/
define
(
'
DEBUG
'
,
'
on
'
);
define
(
'
WEBPATH
'
,
realpath
(
__DIR__
.
'
/..
'
));
//包含框架入口文件
require
WEBPATH
.
'
/libs/lib_config.php
'
;
if
(
empty
(
$
argv
[
2
]))
{
echo
"
php redis_copy.php [aof_file] [dst redis server].
\n"
;
echo
"
etc: php redis_copy.php /data/redis_new_slave/appendonly.aof tcp://192.168.1.73:6001
\n"
;
die;
}
$
aof_file
=
$
argv
[
1
];
$
redis_server
=
$
argv
[
2
];
if
(!
is_file
(
$
aof_file
))
{
echo
"
redis aof file[
$
aof_file
] not exist.
\n"
;
}
Swoole
\
Component
\Redis::
syncFromAof
(
$
aof_file
,
$
redis_server
);
Back
|
FazBrowse Home
|
New Git URL