zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2700) Force ZooKeeper to generate snapshot
Date Fri, 17 Feb 2017 16:29:41 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15872066#comment-15872066
] 

ASF GitHub Bot commented on ZOOKEEPER-2700:
-------------------------------------------

Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/180#discussion_r101793125
  
    --- Diff: src/java/main/org/apache/zookeeper/server/command/SnapCommand.java ---
    @@ -0,0 +1,53 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.zookeeper.server.command;
    +
    +import org.apache.zookeeper.server.ServerCnxn;
    +import org.apache.zookeeper.server.ZooKeeperThread;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.io.PrintWriter;
    +
    +public class SnapCommand extends AbstractFourLetterCommand {
    +    private static final Logger LOG = LoggerFactory.getLogger(SnapCommand.class);
    +
    +    SnapCommand(PrintWriter pw, ServerCnxn serverCnxn) {
    +        super(pw,serverCnxn);
    +    }
    +
    +    @Override
    +    public void commandRun() throws IOException {
    +        if (!isZKServerRunning()) {
    +            pw.println(ZK_NOT_SERVING);
    +        } else {
    +            Thread snapInProcess = new ZooKeeperThread("Snapshot Thread") {
    --- End diff --
    
    Since this PR is targeting master I suggest considering the option of adding a snap API
to ZooKeeperAdmin, which is recently introduced to harden security around dynamic reconfiguration.
ZooKeeperAdmin supports all sorts of authentications built in ZK and we can extend it such
that only admin (or any users that explicitly being granted admin access to cluster) can issue
snap command.


> Force ZooKeeper to generate snapshot
> ------------------------------------
>
>                 Key: ZOOKEEPER-2700
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2700
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Flier Lu
>            Priority: Minor
>
> When cold backup or remote offline sync Zookeeper instances, we need the latest snapshot.
> Add a four letter `snap` command to force Zookeeper to generate snapshot.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message