资源简介
Zookeeper 作为一个分布式的服务框架,主要用来解决分布式集群中应用系统的一致性问题,它能提供基于类似于文件系统的目录节点树方式的数据存储, Zookeeper 作用主要是用来维护和监控存储的数据的状态变化,通过监控这些数据状态的变化,从而达到基于数据的集群管理。
代码片段和文件信息
package org.apache.bookkeeper.benchmark;
/**
* 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.
*/
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.client.QuorumEngine;
import org.apache.log4j.Logger;
import org.apache.zookeeper.KeeperException;
public class MySqlClient {
static Logger LOG = Logger.getLogger(QuorumEngine.class);
BookKeeper x;
LedgerHandle lh;
Integer entryId;
HashMap map;
FileOutputStream fStream;
FileOutputStream fStreamLocal;
long start lastId;
Connection con;
Statement stmt;
public MySqlClient(String hostport String user String pass)
throws ClassNotFoundException {
entryId = 0;
map = new HashMap();
Class.forName(“com.mysql.jdbc.Driver“);
// database is named “bookkeeper“
String url = “jdbc:mysql://“ + hostport + “/bookkeeper“;
try {
con = DriverManager.getConnection(url user pass);
stmt = con.createStatement();
// drop table and recreate it
stmt.execute(“DROP TABLE IF EXISTS data;“);
stmt.execute(“create table data(transaction_id bigint PRIMARY KEY AUTO_INCREMENT content TEXT);“);
LOG.info(“Database initialization terminated“);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void closeHandle() throws KeeperException InterruptedException SQLException{
con.close();
}
/**
* First parameter is an integer defining the length of the message
* Second parameter is the number of writes
* Third parameter is host:port
* Fourth parameter is username
* Fifth parameter is password
* @param args
* @throws ClassNotFoundException
* @throws SQLException
*/
public static void main(String[] args) throws ClassNotFoundException SQLException {
int lenght = Integer.parseInt(args[1]);
StringBuilder sb = new StringBuilder();
while(lenght-- > 0){
sb.append(‘a‘);
}
try {
MySqlClient c = new MySqlClient(args[2] args[3] args[4]);
c.writeSameEntryBatch(sb.toString
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-12 18:17 zookeeper-3.3.6\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\bin\
文件 238 2012-07-29 14:23 zookeeper-3.3.6\bin\README.txt
文件 1843 2012-07-29 14:23 zookeeper-3.3.6\bin\zkCleanup.sh
文件 1049 2012-07-29 14:23 zookeeper-3.3.6\bin\zkCli.cmd
文件 1446 2012-07-29 14:23 zookeeper-3.3.6\bin\zkCli.sh
文件 1333 2012-07-29 14:23 zookeeper-3.3.6\bin\zkEnv.cmd
文件 2274 2012-07-29 14:23 zookeeper-3.3.6\bin\zkEnv.sh
文件 1084 2012-07-29 14:23 zookeeper-3.3.6\bin\zkServer.cmd
文件 5130 2012-07-29 14:23 zookeeper-3.3.6\bin\zkServer.sh
文件 59687 2012-07-29 14:23 zookeeper-3.3.6\build.xm
文件 52566 2012-07-29 14:23 zookeeper-3.3.6\CHANGES.txt
目录 0 2017-09-13 10:09 zookeeper-3.3.6\conf\
文件 535 2012-07-29 14:23 zookeeper-3.3.6\conf\configuration.xsl
文件 1698 2012-07-29 14:23 zookeeper-3.3.6\conf\log4j.properties
文件 426 2017-09-12 18:20 zookeeper-3.3.6\conf\zoo.cfg
文件 380 2012-07-29 14:23 zookeeper-3.3.6\conf\zoo.cfg.bak
文件 380 2012-07-29 14:23 zookeeper-3.3.6\conf\zoo_sample.cfg_1
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\benchmark\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\apache\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\apache\bookkeeper\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\apache\bookkeeper\benchmark\
文件 4669 2012-07-29 14:22 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\apache\bookkeeper\benchmark\MySqlClient.java
文件 8359 2012-07-29 14:22 zookeeper-3.3.6\contrib\bookkeeper\benchmark\org\apache\bookkeeper\benchmark\TestClient.java
文件 5937 2012-07-29 14:22 zookeeper-3.3.6\contrib\bookkeeper\build.xm
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\src\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\src\java\
目录 0 2017-09-12 18:17 zookeeper-3.3.6\contrib\bookkeeper\src\java\org\
............此处省略1590个文件信息
相关资源
- 安装zookeeper-3.4.5
- zookeeper-3.4.8.tar.gz
- dubbo+zookeeper入门资源
- zookeeper-3.4.5-cdh5.10.0.tar.gz
- zookeeper-3.4.6 下载151871
- zookeeper-3.4.6
- zookeeper-3.4.5.tar.gz178819
- zookeeper 分布式实践
- 从Paxos到Zookeeper分布式一致性原理与实
- zookeeper-3.4.5.tar.gz
- zookeeper-3.4.10 64位 Windows服务版
- zookeeper-3.4.8解压即用低分版
- 从Paxos到Zookeeper++分布式一致性原理与
- dubbo zookeeper demo
- zookeeper插件
- eclipse 中实现dubbo provider、customer源代
- jdk-8u171-linux-i586.tar.gz和zookeeper-3.4.6.
- zookeeper+Dubbo环境搭建所需工具
- 尚硅谷大数据之Zookeeper视频笔记+代码
- idea开发的springboot+dubbo+zookeeper的简单
- Zookeeper源码分析
- zkui-2.0 zookeeper可视化管理器
- springboot-mybatis-dubbo-zookeeper项目框架
- zookeeper 使用指导PDF
- zookeeper+dubbo+spring
-
大数据hadoop+spark+hba
se+zookeeper+kafka - 极客学院Zookeeper全套视频和课件
- ZooKeeper分布式专题与Dubbo微服务入门
- springboot+dubbo+myBatis集成
- springboot+dubbo+zookeeper实现分布式系统增
评论
共有 条评论