mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
filer.backup use replication.source.filer
This commit is contained in:
parent
54d815fa04
commit
07bf6f956c
|
@ -83,6 +83,11 @@ func doFilerBackup(grpcDialOption grpc.DialOption, backupOption *FilerBackupOpti
|
||||||
if dataSink == nil {
|
if dataSink == nil {
|
||||||
return fmt.Errorf("no data sink configured in replication.toml")
|
return fmt.Errorf("no data sink configured in replication.toml")
|
||||||
}
|
}
|
||||||
|
if config.GetBool("source.filer.enabled") {
|
||||||
|
*backupOption.filer = config.GetString("source.filer.address")
|
||||||
|
*backupOption.path = config.GetString("source.filer.directory")
|
||||||
|
*backupOption.excludePaths = config.GetString("source.filer.excludeDirectories")
|
||||||
|
}
|
||||||
|
|
||||||
sourceFiler := pb.ServerAddress(*backupOption.filer)
|
sourceFiler := pb.ServerAddress(*backupOption.filer)
|
||||||
sourcePath := *backupOption.path
|
sourcePath := *backupOption.path
|
||||||
|
|
|
@ -59,7 +59,7 @@ func runFilerReplicate(cmd *Command, args []string) bool {
|
||||||
|
|
||||||
// avoid recursive replication
|
// avoid recursive replication
|
||||||
if config.GetBool("notification.source.filer.enabled") && config.GetBool("notification.sink.filer.enabled") {
|
if config.GetBool("notification.source.filer.enabled") && config.GetBool("notification.sink.filer.enabled") {
|
||||||
if config.GetString("source.filer.grpcAddress") == config.GetString("sink.filer.grpcAddress") {
|
if config.GetString("source.filer.address") == config.GetString("sink.filer.address") {
|
||||||
fromDir := config.GetString("source.filer.directory")
|
fromDir := config.GetString("source.filer.directory")
|
||||||
toDir := config.GetString("sink.filer.directory")
|
toDir := config.GetString("sink.filer.directory")
|
||||||
if strings.HasPrefix(toDir, fromDir) {
|
if strings.HasPrefix(toDir, fromDir) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
[source.filer] # deprecated. Only useful with "weed filer.replicate"
|
[source.filer] # deprecated. Only useful with "weed filer.replicate"
|
||||||
enabled = true
|
enabled = true
|
||||||
grpcAddress = "localhost:18888"
|
address = "localhost:8888"
|
||||||
# all files under this directory tree are replicated.
|
# all files under this directory tree are replicated.
|
||||||
# this is not a directory on your hard drive, but on your filer.
|
# this is not a directory on your hard drive, but on your filer.
|
||||||
# i.e., all files with this "prefix" are sent to notification message queue.
|
# i.e., all files with this "prefix" are sent to notification message queue.
|
||||||
|
@ -25,7 +25,7 @@ is_incremental = false
|
||||||
|
|
||||||
[sink.filer]
|
[sink.filer]
|
||||||
enabled = false
|
enabled = false
|
||||||
grpcAddress = "localhost:18888"
|
address = "localhost:8888"
|
||||||
# all replicated files are under this directory tree
|
# all replicated files are under this directory tree
|
||||||
# this is not a directory on your hard drive, but on your filer.
|
# this is not a directory on your hard drive, but on your filer.
|
||||||
# i.e., all received files will be "prefixed" to this directory.
|
# i.e., all received files will be "prefixed" to this directory.
|
||||||
|
|
|
@ -54,9 +54,10 @@ func (fs *FilerSink) IsIncremental() bool {
|
||||||
func (fs *FilerSink) Initialize(configuration util.Configuration, prefix string) error {
|
func (fs *FilerSink) Initialize(configuration util.Configuration, prefix string) error {
|
||||||
fs.isIncremental = configuration.GetBool(prefix + "is_incremental")
|
fs.isIncremental = configuration.GetBool(prefix + "is_incremental")
|
||||||
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
||||||
|
filerAddress := pb.ServerAddress(configuration.GetString(prefix + "address"))
|
||||||
return fs.DoInitialize(
|
return fs.DoInitialize(
|
||||||
"",
|
filerAddress.ToHttpAddress(),
|
||||||
configuration.GetString(prefix+"grpcAddress"),
|
filerAddress.ToGrpcAddress(),
|
||||||
configuration.GetString(prefix+"directory"),
|
configuration.GetString(prefix+"directory"),
|
||||||
configuration.GetString(prefix+"replication"),
|
configuration.GetString(prefix+"replication"),
|
||||||
configuration.GetString(prefix+"collection"),
|
configuration.GetString(prefix+"collection"),
|
||||||
|
|
|
@ -32,9 +32,10 @@ type FilerSource struct {
|
||||||
|
|
||||||
func (fs *FilerSource) Initialize(configuration util.Configuration, prefix string) error {
|
func (fs *FilerSource) Initialize(configuration util.Configuration, prefix string) error {
|
||||||
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
||||||
|
filerAddress := pb.ServerAddress(configuration.GetString(prefix + "address"))
|
||||||
return fs.DoInitialize(
|
return fs.DoInitialize(
|
||||||
"",
|
filerAddress.ToHttpAddress(),
|
||||||
configuration.GetString(prefix+"grpcAddress"),
|
filerAddress.ToGrpcAddress(),
|
||||||
configuration.GetString(prefix+"directory"),
|
configuration.GetString(prefix+"directory"),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue