汇聚架构注册表群集模式

时间:2016-08-26 09:04:29

标签: apache-kafka confluent

我正在使用来自Confluent的Kafka Connect来使用Kafka流并以镶木地板格式写入HDFS。我在1节点中使用Schema Registry服务,它运行正常。现在我想将Schema Registry分发到集群模式以处理故障转移。关于如何实现这一目标的任何链接或片段都非常有用。

4 个答案:

答案 0 :(得分:4)

很难找到,但我们在文档中介绍了这个架构: http://docs.confluent.io/3.0.0/schema-registry/docs/deployment.html#multi-dc-setup

从文档中引用一下(虽然你应该阅读文档,但是包含了很多好的架构建议和恢复版本):

  

假设您运行了Schema Registry,建议您使用以下命令   在新的“从属”数据中心中添加Schema Registry实例的步骤   (称之为DC B):

     

在DC B中,确保Kafka将unclean.leader.election.enable设置为   假。在DC B中的Kafka中,创建_schemas主题。应该有1   partition,kafkastore.topic.replication.factor of 3,and   min.insync.replicas至少2.在DC B中,运行带有Kafka的MirrorMaker   作为源的“主”数据中心和作为目标的DC B中的Kafka。   在DC B中的Schema Registry配置文件中,设置   要匹配的kafkastore.connection.url和schema.registry.zk.namespace   已运行的实例,并将master.eligibility设置为false。   使用这些配置启动新的Schema Registry实例。

答案 1 :(得分:2)

我使用融合的架构注册表docker image组成集群。

docker run --restart always -d -p 8081:8081 --name=schema-registry-1 -e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=ip1:2181,ip2:2181,ip3:2181 -e SCHEMA_REGISTRY_HOST_NAME=schema-registry-1 -e SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081 -e SCHEMA_REGISTRY_DEBUG=true confluentinc/cp-schema-registry:5.2.1-1

docker run --restart always -d -p 8081:8081 --name=schema-registry-2 -e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=ip1:2181,ip2:2181,ip3:2181 -e SCHEMA_REGISTRY_HOST_NAME=schema-registry-2 -e SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081 -e SCHEMA_REGISTRY_DEBUG=true confluentinc/cp-schema-registry:5.2.1-1

docker run --restart always -d -p 8081:8081 --name=schema-registry-3 -e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=ip1:2181,ip2:2181,ip3:2181 -e SCHEMA_REGISTRY_HOST_NAME=schema-registry-3 -e SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081 -e SCHEMA_REGISTRY_DEBUG=true confluentinc/cp-schema-registry:5.2.1-1

一旦启动并运行,我将通过检查Zookeeper的内容来验证是否形成了架构注册表集群,并且其领导者选举是否成功。

$ docker exec -it zookeeper bash
# /usr/bin/zookeeper-shell localhost:2181
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /
[schema_registry, cluster, controller, brokers, zookeeper, admin, isr_change_notification, log_dir_event_notification, controller_epoch, kafka-manager, CruiseControlBrokerList, consumers, latest_producer_id_block, config]
[zk: localhost:2181(CONNECTED) 1] ls /schema_registry
[schema_registry_master, schema_id_counter]
[zk: localhost:2181(CONNECTED) 4] get /schema_registry/schema_registry_master
{"host":"schema-registry-1","port":8081,"master_eligibility":true,"scheme":"http","version":1}
#

希望这会有所帮助。

答案 2 :(得分:1)

您只需将其放在connect-avro-distributed.properties中即可使用多模式注册表:

key.converter.schema.registry.url=http://node1:8081,http://node2:8081
value.converter.schema.registry.url=http://node1:8081,http://node2:8081

希望这对你有用。

答案 3 :(得分:0)

不要忘记在所有节点中都提到import 'package:flutter/material.dart'; void main() => runApp(Cartproduct()); class Cartproduct extends StatefulWidget { @override _CartproductState createState() => _CartproductState(); } class _CartproductState extends State<Cartproduct> { var cart_list = [ { "name": "Avocado", "img": "images/avocado.jpg", "price": 180, "ice-cream": "2 scoops", "sugar": "3 cube" }, { "name": "Mango", "img": "images/mango.jpg", "price": 180, "ice-cream": "1 scoops", "sugar": "2 cube" }, ]; @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: new ListView.builder( shrinkWrap: true, itemCount: 2, itemBuilder: (context, index) { return new Single_cart_prod( prod_name: cart_list[index]['name'], prod_img: cart_list[index]['img'], prod_price: cart_list[index]['price'], prod_ice_cream: cart_list[index]['ice-cream'], prod_sugar: cart_list[index]['sugar'], ); }, ), ), ); } } class Single_cart_prod extends StatelessWidget { final prod_name; final prod_img; final prod_price; final prod_ice_cream; final prod_sugar; Single_cart_prod( {this.prod_name, this.prod_img, this.prod_price, this.prod_ice_cream, this.prod_sugar}); @override Widget build(BuildContext context) { return Card( child: ListTile( title: new Text(prod_name), leading: Image.asset( prod_img, width: 50.0, height: 50.0, ), subtitle: new Column( children: <Widget>[ new Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Row( children: <Widget>[ new Text("Ice-cream: "), new Text( prod_ice_cream, style: TextStyle(color: Colors.red), ), ], ), Row( children: <Widget>[ new Text(" Sugar: "), new Text( prod_sugar, style: TextStyle(color: Colors.red), ), Padding( padding: const EdgeInsets.all(8.0), child: new Container( alignment: Alignment.topLeft, child: new Text( "\Rs${prod_price}", style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold), ), ), ), ], ), new Column( children: <Widget>[ GestureDetector( onTap: () {}, child: new Icon(Icons.arrow_drop_up)), GestureDetector( onTap: () {}, child: new Icon(Icons.arrow_drop_down)), ], ), ], ), ], ), ), ); } }

相关问题