title: ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException:
body: <p>Could you please help me how to fix this the below error while running the command in the cloudera VM 5.13</p>
  
  <pre><code>[cloudera@quickstart ~]$ sudo service kafka-server startStarting Kafka Server (kafka-server): [OK ]
   Kafka Server is running [OK]
  
  [cloudera@quickstart ~]$ /usr/bin/kafka-topics --zookeeper quickstart.cloudera:2181 --list
          SLF4J: Class path contains multiple SLF4J bindings.
          SLF4J: Found binding in [jar:file:/usr/lib/kafka/libs/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: Found binding in [jar:file:/usr/lib/kafka/libs/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
          SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  
  
          [cloudera@quickstart ~]$ /usr/bin/kafka-topics --create --zookeeper quickstart.cloudera:2181/kafka --replication-factor 1 --partitions 1 --topic fast-messages
          SLF4J: Class path contains multiple SLF4J bindings.
          SLF4J: Found binding in [jar:file:/usr/lib/kafka/libs/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: Found binding in [jar:file:/usr/lib/kafka/libs/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
          SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
          Error while executing topic command : replication factor: 1 larger than available brokers: 0
          [2018-08-01 10:39:31,272] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 1 larger than available brokers: 0
           (kafka.admin.TopicCommand$)
  
  
  [cloudera@quickstart ~]$
  </code></pre>
  
  <p>I have installed the kafka using command line steps based on the below link from cloudera site:<br>
                 <a href="https://www.cloudera.com/documentation/kafka/latest/topics/kafka_installing.html" rel="nofollow noreferrer">https://www.cloudera.com/documentation/kafka/latest/topics/kafka_installing.html</a></p>
  
  <p>Please find the below addtional zookeeper details: </p>
  
  <pre><code>[cloudera@quickstart ~]$  zookeeper-client
  
      Connecting to localhost:2181
      2018-08-01 10:43:18,726 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-cdh5.13.0--1, built on 10/04/2017 18:04 GMT
      2018-08-01 10:43:18,737 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=quickstart.cloudera
      2018-08-01 10:43:18,738 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_67
      2018-08-01 10:43:18,744 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
      2018-08-01 10:43:18,745 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/java/jdk1.7.0_67-cloudera/jre
      2018-08-01 10:43:18,745 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/lib/zookeeper/bin/../build/classes:/usr/lib/zookeeper/bin/../build/lib/*.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/lib/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/lib/zookeeper/bin/../lib/jline-2.11.jar:/usr/lib/zookeeper/bin/../zookeeper-3.4.5-cdh5.13.0.jar:/usr/lib/zookeeper/bin/../src/java/lib/*.jar:/etc/zookeeper/conf::/etc/zookeeper/conf:/usr/lib/zookeeper/zookeeper-3.4.5-cdh5.13.0.jar:/usr/lib/zookeeper/zookeeper.jar:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/lib/log4j-1.2.16.jar:/usr/lib/zookeeper/lib/netty-3.10.5.Final.jar:/usr/lib/zookeeper/lib/slf4j-log4j12.jar:/usr/lib/zookeeper/lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/lib/jline-2.11.jar
      2018-08-01 10:43:18,746 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
      2018-08-01 10:43:18,746 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
      2018-08-01 10:43:18,747 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=&lt;NA&gt;
      2018-08-01 10:43:18,747 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
      2018-08-01 10:43:18,748 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
      2018-08-01 10:43:18,748 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-573.el6.x86_64
      2018-08-01 10:43:18,748 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=cloudera
      2018-08-01 10:43:18,749 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/home/cloudera
      2018-08-01 10:43:18,749 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/home/cloudera
      2018-08-01 10:43:18,753 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5cd4927f
      Welcome to ZooKeeper!
      2018-08-01 10:43:18,841 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
      JLine support is enabled
      2018-08-01 10:43:18,883 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established, initiating session, client: /127.0.0.1:52573, server: localhost/127.0.0.1:2181
      2018-08-01 10:43:18,923 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x164f3aeeda8001b, negotiated timeout = 30000
  
      WATCHER::
  
      WatchedEvent state:SyncConnected type:None path:null
  
  
  
  
      [zk: localhost:2181(CONNECTED) 0] ls /brokers/ids
      [0]
      [zk: localhost:2181(CONNECTED) 1]
  
  
  
  
  
  
  
      Server.properties:
  
  
  
      # see kafka.server.KafkaConfig for additional details and defaults
  
      ############################# Server Basics #############################
  
      # The id of the broker. This must be set to a unique integer for each broker.
      broker.id=0
  
      # Switch to enable topic deletion or not, default value is false
      #delete.topic.enable=true
  
      ############################# Socket Server Settings #############################
  
      # The address the socket server listens on. It will get the value returned from
      # java.net.InetAddress.getCanonicalHostName() if not configured.
      #   FORMAT:
      #     listeners = listener_name://host_name:port
      #   EXAMPLE:
      #     listeners = PLAINTEXT://your.host.name:9092
      #listeners=PLAINTEXT://:9092
  
      # Hostname and port the broker will advertise to producers and consumers. If not set,
      # it uses the value for "listeners" if configured.  Otherwise, it will use the value
      # returned from java.net.InetAddress.getCanonicalHostName().
      #advertised.listeners=PLAINTEXT://your.host.name:9092
  
      # Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
      #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
  
      # The number of threads handling network requests
      num.network.threads=3
  
      # The number of threads doing disk I/O
      num.io.threads=8
  
      # The send buffer (SO_SNDBUF) used by the socket server
      socket.send.buffer.bytes=102400
  
      # The receive buffer (SO_RCVBUF) used by the socket server
      socket.receive.buffer.bytes=102400
  
      # The maximum size of a request that the socket server will accept (protection against OOM)
      socket.request.max.bytes=104857600
  
  
      ############################# Log Basics #############################
  
      # A comma seperated list of directories under which to store log files
      log.dirs=/tmp/kafka-logs
  
      # The default number of log partitions per topic. More partitions allow greater
      # parallelism for consumption, but this will also result in more files across
      # the brokers.
      num.partitions=1
  
      # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
      # This value is recommended to be increased for installations with data dirs located in RAID array.
      num.recovery.threads.per.data.dir=1
  
      ############################# Log Flush Policy #############################
  
      # Messages are immediately written to the filesystem but by default we only fsync() to sync
      # the OS cache lazily. The following configurations control the flush of data to disk.
      # There are a few important trade-offs here:
      #    1. Durability: Unflushed data may be lost if you are not using replication.
      #    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
      #    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks.
      # The settings below allow one to configure the flush policy to flush data after a period of time or
      # every N messages (or both). This can be done globally and overridden on a per-topic basis.
  
      # The number of messages to accept before forcing a flush of data to disk
      #log.flush.interval.messages=10000
  
      # The maximum amount of time a message can sit in a log before we force a flush
      #log.flush.interval.ms=1000
  
      ############################# Log Retention Policy #############################
  
      # The following configurations control the disposal of log segments. The policy can
      # be set to delete segments after a period of time, or after a given size has accumulated.
      # A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
      # from the end of the log.
  
      # The minimum age of a log file to be eligible for deletion due to age
      log.retention.hours=168
  
      # A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
      # segments don't drop below log.retention.bytes. Functions independently of log.retention.hours.
      #log.retention.bytes=1073741824
  
      # The maximum size of a log segment file. When this size is reached a new log segment will be created.
      log.segment.bytes=1073741824
  
      # The interval at which log segments are checked to see if they can be deleted according
      # to the retention policies
      log.retention.check.interval.ms=300000
  
      ############################# Zookeeper #############################
  
      # Zookeeper connection string (see zookeeper docs for details).
      # This is a comma separated host:port pairs, each corresponding to a zk
      # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
      # You can also append an optional chroot string to the urls to specify the
      # root directory for all kafka znodes.
      zookeeper.connect=localhost:2181
  
      # Timeout in ms for connecting to zookeeper
      zookeeper.connection.timeout.ms=6000
  </code></pre>