首页 \ 问答 \ 香港SASA的官网有买假货吗?

香港SASA的官网有买假货吗?

香港SASA的官网有买假货吗? 
 代购是什么?。我看见有些人代购的。
更新时间:2023-08-24 14:08

最满意答案

很多使用Zookeeper的情景是需要我们嵌入Zookeeper作为自己的分布式应用系统的一部分来提供分布式服务,此时我们需要通过程序的方式来启动Zookeeper。此时可以通过Zookeeper API的ZooKeeperServerMain类来启动Zookeeper服务。

下面是一个集群模式下启动Zookeeper服务的例子

这里假定我们运行Zookeeper集群的三台机器名分别为fanbinx1,fanbinx2,fanbinx3

首先是zoo.cfg配置文件

[plain] view plain copy print?
tickTime=2000  
dataDir=/tmp/zookeeper/data  
clientPort=2181  
initLimit=10  
syncLimit=5  
server.1=fanbinx1:2888:3888  
server.2=fanbinx2:2888:3888  
server.3=fanbinx3:2888:3888  
启动Zookeeper集群服务的类,如下 
* 这个类同时使用同一个zoo.cfg配置文件来启动Zookeeper服务。
* 在每台机器上启动Zookeeper服务的时候判断当前机器是不是定义在zoo.cfg文件里,如果是获取其中的ID号,然后生成myid文件并将ID写入其中。
* 最后启动Zookeeper服务。

[java] view plain copy print?
package my.zookeeperstudy.server;  

import org.apache.commons.io.FileUtils;  
import org.apache.zookeeper.server.ServerConfig;  
import org.apache.zookeeper.server.ZooKeeperServerMain;  
import org.apache.zookeeper.server.quorum.QuorumPeerConfig;  

import java.io.File;  
import java.io.InputStream;  
import java.net.InetAddress;  
import java.util.Properties;  
import java.util.regex.Matcher;  
import java.util.regex.Pattern;  

public class ClusteredZKServer {  

    public static void main(String[] args) throws Exception {  
        InputStream is = ClusteredZKServer.class.getResourceAsStream("/my/zookeeperstudy/server/zoo.cfg");  
        Properties props = new Properties();  
        try {  
            props.load(is);  
        } finally {  
            is.close();  
        }  

        for (String key : props.stringPropertyNames()) {  
            Pattern pKey = Pattern.compile("^server\\.(\\d)");  
            Pattern pValue = Pattern.compile("([\\w|.]*):\\d*:\\d*");  
            Matcher mKey = pKey.matcher(key);  
            Matcher mValue = pValue.matcher(props.getProperty(key));  
            if (mKey.find() && mValue.find()) {  
                String id = mKey.group(1);  
                String host = mValue.group(1);  
                String thisHostName = InetAddress.getLocalHost().getHostName();  
                String thisHostAddress = InetAddress.getLocalHost().getHostAddress();  
                if (host.equals(thisHostName) || host.equals(thisHostAddress)) {  
                    //System.out.println(new File(props.getProperty("dataDir"), "myid").getAbsolutePath());  
                    FileUtils.write(new File(props.getProperty("dataDir"), "myid"), id);  
                    QuorumPeerConfig quorumConfig = new QuorumPeerConfig();  
                    quorumConfig.parseProperties(props);  

                    final ZooKeeperServerMain zkServer = new ZooKeeperServerMain();  
                    final ServerConfig config = new ServerConfig();  
                    config.readFrom(quorumConfig);  
                    zkServer.runFromConfig(config);  
                }  
            }  
        }  
    }  
}  
客户端测试代码如下,这里可以修改hostname为集群中的任意一台机器

[java] view plain copy print?
package my.zookeeperstudy.server;  

import org.apache.zookeeper.*;  

import java.util.List;  

public class Client {  
    public static void main(String[] args) throws Exception {  
        ZooKeeper zk = new ZooKeeper("fanbinx1:2181,fanbinx2:2181,fanbinx3:2181", 10000,  
                new Watcher() {  
                    public void process(WatchedEvent event) {  
                        System.out.println("event: " + event.getType());  
                    }  
                });  

        System.out.println(zk.getState());  

        zk.create("/myApps", "myAppsData".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);  
        zk.create("/myApps/App1", "App1Data".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);  
        zk.create("/myApps/App2", "App2Data".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);  
        zk.create("/myApps/App3", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);  
        zk.setData("/myApps/App3","App3Data".getBytes(), -1);  

        System.out.println(zk.exists("/myApps", true));  
        System.out.println(new String(zk.getData("/myApps", true, null)));  

        List

  children = zk.getChildren("/myApps", true);  
        for (String child : children) {  
            System.out.println(new String(zk.getData("/myApps/" + child, true, null)));  
            zk.delete("/myApps/" + child,-1);  
        }  

        zk.delete("/myApps",-1);  

        zk.close();  
    }  
}  

测试
* 在集群中的各个机器上分别运行ClusteredZKServer类来启动Zookeeper服务。
* 然后在任意一台机器上运行Client类来连接Zookeeper并操作数据。

相关问答

更多
  • 不可以,kafka必须要依赖一个zookeeper集群才能运行。kafka系群里面各个broker都是通过zookeeper来同步topic列表以及其它broker列表的,一旦连不上zookeeper,kafka也就无法工作。
  • ookeeper是什么Zookeeper,一种分布式应用的协作服务,是Google的Chubby一个开源的实现,是Hadoop的分布式协调服务,它包含一个简单的原语集,应用于分布式应用的协作服务,使得分布式应用可以基于这些接口实现诸如同步、配置维护和分集群或者命名的服务。zookeeper是一个由多个service组成的集群,一个leader,多个follower,每个server保存一份数据部分,全局数据一致,分布式读写,更新请求转发由leader实施.更新请求顺序进行,来自同一个client的更新请求按 ...
  • 很多使用Zookeeper的情景是需要我们嵌入Zookeeper作为自己的分布式应用系统的一部分来提供分布式服务,此时我们需要通过程序的方式来启动Zookeeper。此时可以通过Zookeeper API的ZooKeeperServerMain类来启动Zookeeper服务。 下面是一个集群模式下启动Zookeeper服务的例子 这里假定我们运行Zookeeper集群的三台机器名分别为fanbinx1,fanbinx2,fanbinx3 首先是zoo.cfg配置文件 [plain] view plain c ...
  • ZooKeeper是一个独立的组件,它可以和HDFS配合使用,但没有非得部署在一起的要求,只要网络通就可以。 另外,ZooKeeper建议最少安装在3个节点上,且数目为奇数。
  • 不可以,kafka必须要依赖一个zookeeper集群才能运行。kafka系群里面各个broker都是通过zookeeper来同步topic列表以及其它broker列表的,一旦连不上zookeeper,kafka也就无法工作。
  • (1)解压为zookeepertar -xf -C /home/myuser/zookeeper/ 复制zookeeper文件夹3份,分别重名名为zookeeperA,zookeeperB,zookeeperC。 并且创建数据快照以及日志存放文件夹,命名为zooA,zooB,zooC。
  • AbstractZooKeeper.java package com.ccy.zk; import java.io.IOException; import java.util.concurrent.CountDownLatch; import org.apache.log4j.Logger; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.Wa ...
  • 根据中间件不同部署方式也不同。tomcat下面就要分别部署了,weblogic支持分别部署,也支持统一部署(两种方式各有优缺点,推荐分别部署)。 中间件基本上都支持session共享复制,不过实现方式可能有点区别(有的是基于容器,有的是基于memcache等等)。
  • Failed to resolve address: zookeeper-3 ... Failed to resolve address: zookeeper-1 Zookeeper最初启动并尝试连接到所有可访问的实例后尝试进行领导者选举。 似乎没有任何实例可以访问。 您可能忘记更新zoo.cfg文件中的条目。 这是默认的zoo.cfg的样子 tickTime=2000 dataDir=/var/lib/zookeeper/ clientPort=2181 initLimit=5 syncLimit=2 ...
  • Kafka流具有不同的体系结构 - 它不需要像Spark / Flink这样的集群编排 - 它们只是您可以启动和停止的正常应用程序,如果您启动 - 它们将按比例放大,如果您停止缩小它们。 在内部,他们使用Kafka协调数据处理,与其他Kafka消费者类似。 如果您有Kubernetes,Docker Swarm或其他类似平台,那么您可以将您的应用程序打包到Docker中,并使用该平台运行您的Kafka Streams应用程序。 Kafka streams has different architecture ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)