Pulsar configuration can be managed either via a series of configuration files contained in the conf directory of a Pulsar installation

BookKeeper

BookKeeper 是一个冗余的日志存储系统,Pulsar 用它来持久化存储所有消息。

NameDescription默认值
bookiePortbookie 服务器监听的端口。3181
allowLoopback是否允许 bookie 使用 loopback 接口作为它的主要接口(例如,用于确立身份的接口)。 默认情况下,loopback 接口不允许作为主接口。 使用 loopback 接口作为主接口通常意味着配置错误。 例如,在某些 VPS 设置中,通常不会配置主机名或使主机名解析为 127.0.0.1。 如果情况如此,那么集群中的所有 bookie 都会将其身份设置为 127.0.0.1:3181 并且只有一个能成功加入集群。 对于像这样配置的 VPS,你应该显性地设置监听接口。false
listeningInterfaceThe network interface on which the bookie listens. If not set, the bookie will listen on all interfaces.eth0
journalDirectoryBookKeeper 输出 write-ahead 日志(WAL)的目录data/bookkeeper/journal
ledgerDirectoriesBookKeeper 输出 ledger 快照的目录。 这里可以定义多个目录来存储以逗号分隔的快照,比如 ledgerDirectories=/tmp/bk1-data,/tmp/bk2-data。 最理想的情况是,ledger 目录和日志目录都是在不同的设备中,这减少了随机读写和顺序写入之间的争执。 可以用单个磁盘运行,但性能将显著降低。data/bookkeeper/ledgers
ledgerManagerType用于管理 ledger 如何存储与管理,以及垃圾收集的 ledger 管理器类型。 查看 BookKeeper Internals 获取更多信息。hierarchical
zkLedgersRootPathThe root ZooKeeper path used to store ledger metadata. This parameter is used by the ZooKeeper-based ledger manager as a root znode to store all ledgers./ledgers
ledgerStorageClassLedger 存储实现类org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage
entryLogFilePreallocationEnabled启用或禁用条目日志记录器预分配true
logSizeLimitMax file size of the entry logger, in bytes. A new entry log file will be created when the old one reaches the file size limitation.2147483648
minorCompactionThreshold次级压缩的阈值。 其剩余大小百分比低于此阈值的条目日志文件将在次级压缩中被压缩。 如果设置为零,次级压缩将被禁用。0.2
minorCompactionIntervalTime interval to run minor compaction, in seconds. 如果设置为零,次级压缩将被禁用。3600
majorCompactionThreshold首级压缩的阈值。 其剩余大小百分比低于此阈值的条目日志文件将在首级压缩中被压缩。 剩余大小百分比仍高于阈值的条目日志文件永远不会被压缩。 如果设置为零,次级压缩将被禁用。0.5
majorCompactionIntervalThe time interval to run major compaction, in seconds. If set to less than zero, the major compaction is disabled.86400
compactionMaxOutstandingRequests设置压缩过程中无需刷写的最大条目数。 在压缩时,条目被写入条目日志,新的偏移被缓存在内存中。 一旦条目日志被刷写,索引将被新的偏移量更新。 此参数控制在强制刷写之前添加到条目日志的条目数量。 此参数的值越狱高意味着将有更多内存用于偏移量。 每个偏移量由三个 long 型组成。 此参数不应被修改,除非你完全了解其后果。100000
compactionRate压缩过程中读取条目的频率,以每秒添加数为单位。1000
isThrottleByBytes以字节或条目为单位进行阈值压缩false
compactionRateByEntries压缩过程中读取条目的频率,以每秒添加数为单位。1000
compactionRateByBytesSet the rate at which compaction will readd entries. The unit is bytes added per second.1000000
journalMaxSizeMBMax file size of journal file, in megabytes. A new journal file will be created when the old one reaches the file size limitation.2048
journalMaxBackupsThe max number of old journal filse to keep. Keeping a number of old journal files would help data recovery in special cases.5
journalPreAllocSizeMB每次在日志中预分配的空间大小。16
journalWriteBufferSizeKB日志使用的写缓冲区大小。64
journalRemoveFromPageCache强制写入后,页是否应从页缓存中删除。true
journalAdaptiveGroupWrites是否将日志的强制写入进行分组,这能优化分组提交获得更高吞吐量。true
journalMaxGroupWaitMSec实现分组写入日志的最大延迟。1
journalAlignmentSize所有日志的写入和提交应与给定的大小对齐4096
journalBufferedWritesThreshold要实现分组的最大写入缓存524288
journalFlushWhenQueueEmpty是否在日志队列为空时刷写日志false
numJournalCallbackThreads处理日志回调的线程数8
rereplicationEntryBatchSize重复制时在 fragment 中保存的最大条目数5000
gcWaitTime触发下一次垃圾收集的时间间隔(毫秒)。 由于垃圾收集工作在后台进行,过于频繁的垃圾收集工作将降低性能。 如果磁盘容量足够,最好用更大的 gc 时间间隔。900000
gcOverreplicatedLedgerWaitTime触发下一次垃圾收集器收集过度复制的 ledger 的时间间隔(毫秒)。 这种情况不应经常发生,因为我们从 zookeeper 的 bookie 上读取所有 ledger 的元数据。86400000
flushInterval刷新 ledger 索引页到磁盘的间隔,以毫秒计。 刷新索引文件会引入大量随机磁盘 I/O。 如果在不同的设备上将日志目录和 ledger 目录分开,刷写就不会影响性能。 但是,如果在同一设备上放置日志目录和 ledger 目录,性能会在频繁刷写的情况下大幅下降。 你可以考虑增加刷写间隔来获得更好的性能,但你需要在 bookie 服务器失败重启后花更多时间。60000
bookieDeathWatchInterval查看 bookie 是否已死亡的时间间隔,以毫秒为单位1000
zkServersA list of one of more servers on which zookeeper is running. The server list can be comma separated values, for example: zkServers=zk1:2181,zk2:2181,zk3:2181.localhost:2181
zkTimeoutZooKeeper 客户端会话超时时间,以毫秒为单位。Bookie 服务器如果收到 SESSION_EXPIRED,将退出,因为它从 ZooKeeper 进行分区超过了会话超时时间。JVM 垃圾收集和磁盘 I/O 会导致 SESSION_EXPIRED。 增加这个值可以帮助避免这个问题30000
serverTcpNoDelay此设置用于启用/禁用 Nagle 的算法,该算法能通过减少通过网络发送的数据包数量来提高 TCP/IP 网络效率。 如果你正在发送许多小消息,这样在单个 IP 数据包中就可以放入不止一个消息,设置 server.tcpnodelay 为 false 来启用 Nagle 算法可以提供更好的性能。true
openFileLimit在 bookie 服务器上可以打开 ledger 索引文件的最大数量。如果 ledger 索引文件数量达到这个限制,bookie 服务器会开始将一些 ledger 从内存交换到磁盘。 过于频繁的交换会影响性能。 你可以根据你的要求调整这个数字以获得性能提升。0
pageSizeledger 缓存中索引页的大小,以字节为单位。一个大的索引页可以改善将页写入磁盘的性能。当你有少量有 ledger 并且这些 ledger 有着相似数量的条目时,会很高效。 如果你有大量的 ledger,而每个 ledger 都有较少的条目,较小的索引页面将会提高内存使用率。8192
pageLimit在 ledger 缓存中提供多少索引页面。如果索引页面数量达到此限制,bookie 服务器会开始将一些 ledger 从内存交换到磁盘。 当你发现交换变得更频繁时,可以增加这个值。 但请确认 pageLimit*page 的大小不应超过 JVM 最大内存限制,否则你将会得到 OutOfMemoryException。 总的来说,使用更小的索引页面可以在 ledger 量大而条目数量少的情况下获得更好的性能。如果 pageLimit 为 -1, bookie 服务器会使用 1/3 的 JVM 内存来计算索引页面的限制数量。0
readOnlyModeEnabled如果所有已配置的 ledger 目录已满,则只支持客户的读取请求。 如果 “readOnlyModeEnabled=true” 那么当所有的 ledger 磁盘满时,bookie 会被转换为只读模式并只处理读请求。 否则 bookie 将被关闭。 默认情况下,这会被禁用。true
diskUsageThreshold对于每个 ledger 目录,可使用的最大磁盘空间。 默认值为 0.95f。 比如,最多只能使用 95% 的磁盘,此后不会将任何内容写入该分区。 如果所有 ledger 目录分区已满,并且设置了“readOnlyModeEnabled=true”,那么 bookie 将会转为只读模式。 有效值应在 0 和 1 之间(不包含端点)。0.95
diskCheckInterval磁盘检查间隔,以毫秒为单位,检查 ledger 目录使用情况的时间间隔。10000
auditorPeriodicCheckInterval审查者对集群内所有 ledger 进行核对的时间间隔。 默认情况下,每周运行一次。 间隔以秒为单位。 要完全禁用定期检查,请将此设置为 0。 请注意,定期检查会给集群带来额外的负荷,因此每天的运行次数不应超过一次。604800
auditorPeriodicBookieCheckInterval审查者 bookie 检查的时间间隔。 审查者 bookie 检查,检查 ledger 的元数据来查看哪些 bookie 应该包含各个 ledger 的条目。 如果本应包含条目的 bookie 不可用,包含该条目的 ledger 会被标记去做恢复。 设置为 0 会禁用定期检查。 当 bookie 失效时,bookie 检查仍然会进行。 间隔以秒为单位。86400
numAddWorkerThreadsnumber of threads that should handle write requests. if zero, the writes would be handled by netty threads directly.0
numReadWorkerThreadsnumber of threads that should handle read requests. if zero, the reads would be handled by netty threads directly.8
maxPendingReadRequestsPerThread如果启用了读 worker 线程,限制待处理请求的数量,以避免执行器队列无止境增长。2500
readBufferSizeBytes用作 BufferedReadChannel 容量的字节数量。4096
writeBufferSizeBytes用作写缓存容量的字节数65536
useHostNameAsBookieIDWhether the bookie should use its hostname to register with the coordination service (e.g.: zookeeper service). When false, bookie will use its ipaddress for the registration.false
statsProviderClassorg.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
prometheusStatsHttpPort8000
dbStorage_writeCacheMaxSizeMbSize of Write Cache. Memory is allocated from JVM direct memory. Write cache is used to buffer entries before flushing into the entry log For good performance, it should be big enough to hold a sub25% 的直接内存
dbStorage_readAheadCacheMaxSizeMbSize of Read cache. Memory is allocated from JVM direct memory. This read cache is pre-filled doing read-ahead whenever a cache miss happens25% 的直接内存
dbStorage_readAheadCacheBatchSize当读缓存 miss 发生后预装填的条目数量1000
dbStorage_rocksDB_blockCacheSizeSize of RocksDB block-cache. For best performance, this cache should be big enough to hold a significant portion of the index database which can reach ~2GB in some cases10% 的直接内存
dbStorage_rocksDB_writeBufferSizeMB64
dbStorage_rocksDB_sstSizeInMB64
dbStorage_rocksDB_blockSize65536
dbStorage_rocksDB_bloomFilterBitsPerKey10
dbStorage_rocksDB_numLevels-1
dbStorage_rocksDB_numFilesInLevel04
dbStorage_rocksDB_maxSizeInLevel1MB256

Broker

Pulsar broker 负责处理从生产者发出的消息、向消费者派发消息、在集群间复制数据,等等。

NameDescription默认值
enablePersistentTopicsWhether persistent topics are enabled on the brokertrue
enableNonPersistentTopicsWhether non-persistent topics are enabled on the brokertrue
functionsWorkerEnabledWhether the Pulsar Functions worker service is enabled in the brokerfalse
zookeeperServersZookeeper quorum connection string
configurationStoreServers配置存储连接字符串(以逗号分隔的列表)
brokerServicePortBroker data port6650
brokerServicePortTlsBroker data port for TLS6651
webServicePortPort to use to server HTTP request8080
webServicePortTlsPort to use to server HTTPS request8443
webSocketServiceEnabledEnable the WebSocket API service in brokerfalse
bindAddressHostname or IP address the service binds on, default is 0.0.0.0.0.0.0.0
advertisedAddressHostname or IP address the service advertises to the outside world. If not set, the value of InetAddress.getLocalHost().getHostName() is used.
clusterNameName of the cluster to which this broker belongs to
brokerDeduplicationEnabledSets the default behavior for message deduplication in the broker. If enabled, the broker will reject messages that were already stored in the topic. This setting can be overridden on a per-namespace basis.false
brokerDeduplicationMaxNumberOfProducersThe maximum number of producers for which information will be stored for deduplication purposes.10000
brokerDeduplicationEntriesIntervalThe number of entries after which a deduplication informational snapshot is taken. A larger interval will lead to fewer snapshots being taken, though this would also lengthen the topic recovery time (the time required for entries published after the snapshot to be replayed).1000
brokerDeduplicationProducerInactivityTimeoutMinutesThe time of inactivity (in minutes) after which the broker will discard deduplication information related to a disconnected producer.360
zooKeeperSessionTimeoutMillisZookeeper session timeout in milliseconds30000
brokerShutdownTimeoutMsTime to wait for broker graceful shutdown. After this time elapses, the process will be killed60000
backlogQuotaCheckEnabledEnable backlog quota check. Enforces action on topic when the quota is reachedtrue
backlogQuotaCheckIntervalInSecondsHow often to check for topics that have reached the quota60
backlogQuotaDefaultLimitGBDefault per-topic backlog quota limit10
brokerDeleteInactiveTopicsEnabledEnable the deletion of inactive topicstrue
brokerDeleteInactiveTopicsFrequencySecondsHow often to check for inactive topics60
messageExpiryCheckIntervalInMinutesHow frequently to proactively check and purge expired messages5
brokerServiceCompactionMonitorIntervalInSecondsInterval between checks to see if topics with compaction policies need to be compacted60
activeConsumerFailoverDelayTimeMillisHow long to delay rewinding cursor and dispatching messages when active consumer is changed.1000
clientLibraryVersionCheckEnabledEnable check for minimum allowed client library versionfalse
clientLibraryVersionCheckAllowUnversionedAllow client libraries with no version informationtrue
statusFilePathPath for the file used to determine the rotation status for the broker when responding to service discovery health checks
preferLaterVersionsIf true, (and ModularLoadManagerImpl is being used), the load manager will attempt to use only brokers running the latest software version (to minimize impact to bundles)false
tlsEnabledEnable TLSfalse
tlsCertificateFilePathTLS证书文件的路径
tlsKeyFilePathTLS私钥文件的路径
tlsTrustCertsFilePathPath for the trusted TLS certificate file
tlsAllowInsecureConnectionAccept untrusted TLS certificate from clientfalse
tlsProtocolsSpecify the tls protocols the broker will use to negotiate during TLS Handshake. Multiple values can be specified, separated by commas. Example:- TLSv1.2, TLSv1.1, TLSv1
tlsCiphersSpecify the tls cipher the broker will use to negotiate during TLS Handshake. Multiple values can be specified, separated by commas. Example:- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
tokenSecretKeyConfigure the secret key to be used to validate auth tokens. The key can be specified like: tokenSecretKey=data:base64,xxxxxxxxx or tokenSecretKey=file:///my/secret.key
tokenPublicKeyConfigure the public key to be used to validate auth tokens. The key can be specified like: tokenPublicKey=data:base64,xxxxxxxxx or tokenPublicKey=file:///my/secret.key
tokenAuthClaimSpecify which of the token’s claims will be used as the authentication “principal” or “role”. The default “sub” claim will be used if this is left blank
maxUnackedMessagesPerConsumerMax number of unacknowledged messages allowed to receive messages by a consumer on a shared subscription. Broker will stop sending messages to consumer once, this limit reaches until consumer starts acknowledging messages back. Using a value of 0, is disabling unackeMessage limit check and consumer can receive messages without any restriction50000
maxUnackedMessagesPerSubscriptionMax number of unacknowledged messages allowed per shared subscription. Broker will stop dispatching messages to all consumers of the subscription once this limit reaches until consumer starts acknowledging messages back and unack count reaches to limit/2. Using a value of 0, is disabling unackedMessage-limit check and dispatcher can dispatch messages without any restriction200000
subscriptionRedeliveryTrackerEnabledEnable subscription message redelivery trackertrue
maxConcurrentLookupRequestMax number of concurrent lookup request broker allows to throttle heavy incoming lookup traffic50000
maxConcurrentTopicLoadRequestMax number of concurrent topic loading request broker allows to control number of zk-operations5000
authenticationEnabledEnable authenticationfalse
authenticationProvidersAutentication provider name list, which is comma separated list of class names
authorizationEnabledEnforce authorizationfalse
superUserRolesRole names that are treated as “super-user”, meaning they will be able to do all admin operations and publish/consume from all topics
brokerClientAuthenticationPluginAuthentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters
brokerClientAuthenticationParameters
athenzDomainNamesSupported Athenz provider domain names(comma separated) for authentication
bookkeeperClientAuthenticationPluginAuthentication plugin to use when connecting to bookies
bookkeeperClientAuthenticationParametersNameBookKeeper auth plugin implementatation specifics parameters name and values
bookkeeperClientAuthenticationParameters
bookkeeperClientTimeoutInSecondsTimeout for BK add / read operations30
bookkeeperClientSpeculativeReadTimeoutInMillisSpeculative reads are initiated if a read request doesn’t complete within a certain time Using a value of 0, is disabling the speculative reads0
bookkeeperClientHealthCheckEnabledEnable bookies health check. Bookies that have more than the configured number of failure within the interval will be quarantined for some time. During this period, new ledgers won’t be created on these bookiestrue
bookkeeperClientHealthCheckIntervalSeconds60
bookkeeperClientHealthCheckErrorThresholdPerInterval5
bookkeeperClientHealthCheckQuarantineTimeInSeconds1800
bookkeeperClientRackawarePolicyEnabledEnable rack-aware bookie selection policy. BK will chose bookies from different racks when forming a new bookie ensembletrue
bookkeeperClientRegionawarePolicyEnabledEnable region-aware bookie selection policy. BK will chose bookies from different regions and racks when forming a new bookie ensemble. If enabled, the value of bookkeeperClientRackawarePolicyEnabled is ignoredfalse
bookkeeperClientReorderReadSequenceEnabledEnable/disable reordering read sequence on reading entries.false
bookkeeperClientIsolationGroupsEnable bookie isolation by specifying a list of bookie groups to choose from. Any bookie outside the specified groups will not be used by the broker
bookkeeperClientSecondaryIsolationGroupsEnable bookie secondary-isolation group if bookkeeperClientIsolationGroups doesn’t have enough bookie available.
bookkeeperClientMinAvailableBookiesInIsolationGroupsMinimum bookies that should be available as part of bookkeeperClientIsolationGroups else broker will include bookkeeperClientSecondaryIsolationGroups bookies in isolated list.
bookkeeperEnableStickyReadsEnable/disable having read operations for a ledger to be sticky to a single bookie. If this flag is enabled, the client will use one single bookie (by preference) to read all entries for a ledger.true
managedLedgerDefaultEnsembleSizeNumber of bookies to use when creating a ledger2
managedLedgerDefaultWriteQuorumNumber of copies to store for each message2
managedLedgerDefaultAckQuorumNumber of guaranteed copies (acks to wait before write is complete)2
managedLedgerCacheSizeMBAmount of memory to use for caching data payload in managed ledger. This memory is allocated from JVM direct memory and it’s shared across all the topics running in the same broker. By default, uses 1/5th of available direct memory
managedLedgerCacheCopyEntriesWhether we should make a copy of the entry payloads when inserting in cachefalse
managedLedgerCacheEvictionWatermarkThreshold to which bring down the cache level when eviction is triggered0.9
managedLedgerCacheEvictionFrequencyConfigure the cache eviction frequency for the managed ledger cache (evictions/sec)100.0
managedLedgerCacheEvictionTimeThresholdMillisAll entries that have stayed in cache for more than the configured time, will be evicted1000
managedLedgerCursorBackloggedThresholdConfigure the threshold (in number of entries) from where a cursor should be considered ‘backlogged’ and thus should be set as inactive.1000
managedLedgerDefaultMarkDeleteRateLimitRate limit the amount of writes per second generated by consumer acking the messages1.0
managedLedgerMaxEntriesPerLedgerMax number of entries to append to a ledger before triggering a rollover. A ledger rollover is triggered on these conditions:
  • Either the max rollover time has been reached
  • or max entries have been written to the ledged and at least min-time has passed | 50000 | | managedLedgerMinLedgerRolloverTimeMinutes | Minimum time between ledger rollover for a topic | 10 | | managedLedgerMaxLedgerRolloverTimeMinutes | Maximum time before forcing a ledger rollover for a topic | 240 | | managedLedgerCursorMaxEntriesPerLedger | Max number of entries to append to a cursor ledger | 50000 | | managedLedgerCursorRolloverTimeInSeconds | Max time before triggering a rollover on a cursor ledger | 14400 | | managedLedgerMaxUnackedRangesToPersist | Max number of “acknowledgment holes” that are going to be persistently stored. When acknowledging out of order, a consumer will leave holes that are supposed to be quickly filled by acking all the messages. The information of which messages are acknowledged is persisted by compressing in “ranges” of messages that were acknowledged. After the max number of ranges is reached, the information will only be tracked in memory and messages will be redelivered in case of crashes. | 1000 | | autoSkipNonRecoverableData | Skip reading non-recoverable/unreadable data-ledger under managed-ledger’s list.It helps when data-ledgers gets corrupted at bookkeeper and managed-cursor is stuck at that ledger. | false | | loadBalancerEnabled | Enable load balancer | true | | loadBalancerPlacementStrategy | Strategy to assign a new bundle weightedRandomSelection | | | loadBalancerReportUpdateThresholdPercentage | Percentage of change to trigger load report update | 10 | | loadBalancerReportUpdateMaxIntervalMinutes | maximum interval to update load report | 15 | | loadBalancerHostUsageCheckIntervalMinutes | Frequency of report to collect | 1 | | loadBalancerSheddingIntervalMinutes | Load shedding interval. Broker periodically checks whether some traffic should be offload from some over-loaded broker to other under-loaded brokers | 30 | | loadBalancerSheddingGracePeriodMinutes | Prevent the same topics to be shed and moved to other broker more that once within this timeframe | 30 | | loadBalancerBrokerMaxTopics | Usage threshold to allocate max number of topics to broker | 50000 | | loadBalancerBrokerUnderloadedThresholdPercentage | Usage threshold to determine a broker as under-loaded | 1 | | loadBalancerBrokerOverloadedThresholdPercentage | Usage threshold to determine a broker as over-loaded | 85 | | loadBalancerResourceQuotaUpdateIntervalMinutes | Interval to update namespace bundle resource quotat | 15 | | loadBalancerBrokerComfortLoadLevelPercentage | Usage threshold to determine a broker is having just right level of load | 65 | | loadBalancerAutoBundleSplitEnabled | enable/disable namespace bundle auto split | false | | loadBalancerNamespaceBundleMaxTopics | maximum topics in a bundle, otherwise bundle split will be triggered | 1000 | | loadBalancerNamespaceBundleMaxSessions | maximum sessions (producers + consumers) in a bundle, otherwise bundle split will be triggered | 1000 | | loadBalancerNamespaceBundleMaxMsgRate | maximum msgRate (in + out) in a bundle, otherwise bundle split will be triggered | 1000 | | loadBalancerNamespaceBundleMaxBandwidthMbytes | maximum bandwidth (in + out) in a bundle, otherwise bundle split will be triggered | 100 | | loadBalancerNamespaceMaximumBundles | maximum number of bundles in a namespace | 128 | | replicationMetricsEnabled | Enable replication metrics | true | | replicationConnectionsPerBroker | Max number of connections to open for each broker in a remote cluster More connections host-to-host lead to better throughput over high-latency links. | 16 | | replicationProducerQueueSize | Replicator producer queue size | 1000 | | replicatorPrefix | Replicator prefix used for replicator producer name and cursor name pulsar.repl | | | replicationTlsEnabled | Enable TLS when talking with other clusters to replicate messages | false | | defaultRetentionTimeInMinutes | Default message retention time | | | defaultRetentionSizeInMB | Default retention size | 0 | | keepAliveIntervalSeconds | How often to check whether the connections are still alive | 30 | | brokerServicePurgeInactiveFrequencyInSeconds | How often broker checks for inactive topics to be deleted (topics with no subscriptions and no one connected) | 60 | | loadManagerClassName | Name of load manager to use | org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl | | managedLedgerOffloadDriver | Driver to use to offload old data to long term storage (Possible values: S3) | | | managedLedgerOffloadMaxThreads | Maximum number of thread pool threads for ledger offloading | 2 | | s3ManagedLedgerOffloadRegion | For Amazon S3 ledger offload, AWS region | | | s3ManagedLedgerOffloadBucket | For Amazon S3 ledger offload, Bucket to place offloaded ledger into | | | s3ManagedLedgerOffloadServiceEndpoint | For Amazon S3 ledger offload, Alternative endpoint to connect to (useful for testing) | | | s3ManagedLedgerOffloadMaxBlockSizeInBytes | For Amazon S3 ledger offload, Max block size in bytes. (64MB by default, 5MB minimum) | 67108864 | | s3ManagedLedgerOffloadReadBufferSizeInBytes | For Amazon S3 ledger offload, Read buffer size in bytes (1MB by default) | 1048576 |

Client

The pulsar-client CLI tool can be used to publish messages to Pulsar and consume messages from Pulsar topics. This tool can be used in lieu of a client library.

NameDescription默认值
webServiceUrl群集的 web URL。http://localhost:8080/
brokerServiceUrl集群的Pulsar 协议地址。pulsar://localhost:6650/
authPlugin身份认证插件。
authParams群集的身份认证参数, 逗号分隔的字符串。
useTls是否在群集中强制执行 TLS 验证。false
tlsAllowInsecureConnection
tlsTrustCertsFilePath

Service discovery

NameDescription默认值
zookeeperServersZookeeper quorum connection string (comma-separated)
configurationStoreServers配置存储连接字符串(以逗号分隔的列表)
zookeeperSessionTimeoutMsZooKeeper session timeout30000
servicePortPort to use to server binary-proto request6650
servicePortTlsPort to use to server binary-proto-tls request6651
webServicePortPort that discovery service listen on8080
webServicePortTlsPort to use to server HTTPS request8443
bindOnLocalhostControl whether to bind directly on localhost rather than on normal hostnamefalse
authenticationEnabledEnable authenticationfalse
authenticationProvidersAuthentication provider name list, which is comma separated list of class names (comma-separated)
authorizationEnabledEnforce authorizationfalse
superUserRolesRole names that are treated as “super-user”, meaning they will be able to do all admin operations and publish/consume from all topics (comma-separated)
tlsEnabledEnable TLSfalse
tlsCertificateFilePathTLS证书文件的路径
tlsKeyFilePathTLS私钥文件的路径

Log4j

Name默认值
pulsar.root.loggerWARN,CONSOLE
pulsar.log.dirlogs
pulsar.log.filepulsar.log
log4j.rootLogger${pulsar.root.logger}
log4j.appender.CONSOLEorg.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.ThresholdDEBUG
log4j.appender.CONSOLE.layoutorg.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
log4j.appender.ROLLINGFILEorg.apache.log4j.DailyRollingFileAppender
log4j.appender.ROLLINGFILE.ThresholdDEBUG
log4j.appender.ROLLINGFILE.File${pulsar.log.dir}/${pulsar.log.file}
log4j.appender.ROLLINGFILE.layoutorg.apache.log4j.PatternLayout
log4j.appender.ROLLINGFILE.layout.ConversionPattern%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
log4j.appender.TRACEFILEorg.apache.log4j.FileAppender
log4j.appender.TRACEFILE.ThresholdTRACE
log4j.appender.TRACEFILE.Filepulsar-trace.log
log4j.appender.TRACEFILE.layoutorg.apache.log4j.PatternLayout
log4j.appender.TRACEFILE.layout.ConversionPattern%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n

Log4j shell

Name默认值
bookkeeper.root.loggerERROR,CONSOLE
log4j.rootLogger${bookkeeper.root.logger}
log4j.appender.CONSOLEorg.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.ThresholdDEBUG
log4j.appender.CONSOLE.layoutorg.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern%d{ABSOLUTE} %-5p %m%n
log4j.logger.org.apache.zookeeperERROR
log4j.logger.org.apache.bookkeeperERROR
log4j.logger.org.apache.bookkeeper.bookie.BookieShellINFO

Standalone

NameDescription默认值
zookeeperServersThe quorum connection string for local ZooKeeper
configurationStoreServers配置存储连接字符串(以逗号分隔的列表)
brokerServicePortThe port on which the standalone broker listens for connections6650
webServicePortTHe port used by the standalone broker for HTTP requests8080
bindAddressThe hostname or IP address on which the standalone service binds0.0.0.0
advertisedAddressThe hostname or IP address that the standalone service advertises to the outside world. If not set, the value of InetAddress.getLocalHost().getHostName() is used.
clusterNameThe name of the cluster that this broker belongs to.standalone
zooKeeperSessionTimeoutMillisThe ZooKeeper session timeout, in milliseconds.30000
brokerShutdownTimeoutMsThe time to wait for graceful broker shutdown. After this time elapses, the process will be killed.60000
backlogQuotaCheckEnabledEnable the backlog quota check, which enforces a specified action when the quota is reached.true
backlogQuotaCheckIntervalInSecondsHow often to check for topics that have reached the backlog quota.60
backlogQuotaDefaultLimitGBThe default per-topic backlog quota limit.10
ttlDurationDefaultInSecondsDefault ttl for namespaces if ttl is not already configured at namespace policies.0
brokerDeleteInactiveTopicsEnabledEnable the deletion of inactive topics.true
brokerDeleteInactiveTopicsFrequencySecondsHow often to check for inactive topics, in seconds.60
messageExpiryCheckIntervalInMinutesHow often to proactively check and purged expired messages.5
activeConsumerFailoverDelayTimeMillisHow long to delay rewinding cursor and dispatching messages when active consumer is changed.1000
clientLibraryVersionCheckEnabledEnable checks for minimum allowed client library version.false
clientLibraryVersionCheckAllowUnversionedAllow client libraries with no version informationtrue
statusFilePathThe path for the file used to determine the rotation status for the broker when responding to service discovery health checks/usr/local/apache/htdocs
maxUnackedMessagesPerConsumerThe maximum number of unacknowledged messages allowed to be received by consumers on a shared subscription. The broker will stop sending messages to a consumer once this limit is reached or until the consumer begins acknowledging messages. A value of 0 disables the unacked message limit check and thus allows consumers to receive messages without any restrictions.50000
maxUnackedMessagesPerSubscriptionThe same as above, except per subscription rather than per consumer.200000
authenticationEnabledEnable authentication for the broker.false
authenticationProvidersA comma-separated list of class names for authentication providers.false
authorizationEnabledEnforce authorization in brokers.false
superUserRolesRole names that are treated as “superusers.” Superusers are authorized to perform all admin tasks.
brokerClientAuthenticationPluginThe authentication settings of the broker itself. Used when the broker connects to other brokers either in the same cluster or from other clusters.
brokerClientAuthenticationParametersThe parameters that go along with the plugin specified using brokerClientAuthenticationPlugin.
athenzDomainNamesSupported Athenz authentication provider domain names as a comma-separated list.
bookkeeperClientAuthenticationPluginAuthentication plugin to be used when connecting to bookies (BookKeeper servers).
bookkeeperClientAuthenticationParametersNameBookKeeper authentication plugin implementation parameters and values.
bookkeeperClientAuthenticationParametersParameters associated with the bookkeeperClientAuthenticationParametersName
bookkeeperClientTimeoutInSecondsTimeout for BookKeeper add and read operations.30
bookkeeperClientSpeculativeReadTimeoutInMillisSpeculative reads are initiated if a read request doesn’t complete within a certain time. A value of 0 disables speculative reads.0
bookkeeperClientHealthCheckEnabledEnable bookie health checks.true
bookkeeperClientHealthCheckIntervalSecondsThe time interval, in seconds, at which health checks are performed. New ledgers are not created during health checks.60
bookkeeperClientHealthCheckErrorThresholdPerIntervalError threshold for health checks.5
bookkeeperClientHealthCheckQuarantineTimeInSecondsIf bookies have more than the allowed number of failures within the time interval specified by bookkeeperClientHealthCheckIntervalSeconds1800
bookkeeperClientRackawarePolicyEnabledtrue
bookkeeperClientRegionawarePolicyEnabledfalse
bookkeeperClientReorderReadSequenceEnabledfalse
bookkeeperClientIsolationGroups
managedLedgerDefaultEnsembleSize1
managedLedgerDefaultWriteQuorum1
managedLedgerDefaultAckQuorum1
managedLedgerCacheSizeMB1024
managedLedgerCacheEvictionWatermark0.9
managedLedgerDefaultMarkDeleteRateLimit0.1
managedLedgerMaxEntriesPerLedger50000
managedLedgerMinLedgerRolloverTimeMinutes10
managedLedgerMaxLedgerRolloverTimeMinutes240
managedLedgerCursorMaxEntriesPerLedger50000
managedLedgerCursorRolloverTimeInSeconds14400
autoSkipNonRecoverableDatafalse
loadBalancerEnabledfalse
loadBalancerPlacementStrategyweightedRandomSelection
loadBalancerReportUpdateThresholdPercentage10
loadBalancerReportUpdateMaxIntervalMinutes15
loadBalancerHostUsageCheckIntervalMinutes1
loadBalancerSheddingIntervalMinutes30
loadBalancerSheddingGracePeriodMinutes30
loadBalancerBrokerMaxTopics50000
loadBalancerBrokerUnderloadedThresholdPercentage1
loadBalancerBrokerOverloadedThresholdPercentage85
loadBalancerResourceQuotaUpdateIntervalMinutes15
loadBalancerBrokerComfortLoadLevelPercentage65
loadBalancerAutoBundleSplitEnabledfalse
loadBalancerNamespaceBundleMaxTopics1000
loadBalancerNamespaceBundleMaxSessions1000
loadBalancerNamespaceBundleMaxMsgRate1000
loadBalancerNamespaceBundleMaxBandwidthMbytes100
loadBalancerNamespaceMaximumBundles128
replicationMetricsEnabledtrue
replicationConnectionsPerBroker16
replicationProducerQueueSize1000
defaultRetentionTimeInMinutes0
defaultRetentionSizeInMB0
keepAliveIntervalSeconds30
brokerServicePurgeInactiveFrequencyInSeconds60

WebSocket

NameDescription默认值
configurationStoreServers
zooKeeperSessionTimeoutMillis30000
serviceUrl
serviceUrlTls
brokerServiceUrl
brokerServiceUrlTls
webServicePort8080
webServicePortTls8443
bindAddress0.0.0.0
clusterName
authenticationEnabledfalse
authenticationProviders
authorizationEnabledfalse
superUserRoles
brokerClientAuthenticationPlugin
brokerClientAuthenticationParameters
tlsEnabledfalse
tlsAllowInsecureConnectionfalse
tlsCertificateFilePath
tlsKeyFilePath
tlsTrustCertsFilePath

Pulsar proxy

The Pulsar proxy can be configured in the conf/proxy.conf file.

NameDescription默认值
zookeeperServersZooKeeper quorum 连接字符串(以逗号分隔的列表)
configurationStoreServers配置存储连接字符串(以逗号分隔的列表)
zookeeperSessionTimeoutMsZooKeeper会话超时(以毫秒为单位)30000
servicePort用于服务器二进制Protobuf请求的端口6650
servicePortTls用于服务器二进制Protobuf TLS请求的端口6651
statusFilePath在响应服务发现健康检查时,用于确定代理实例的轮换状态的文件的路径
authenticationEnabled是否为Pulsar代理启用身份验证false
authenticationProviders身份验证提供者名称列表(以逗号分隔的类名列表)
authorizationEnabled是否由Pulsar代理强制执行授权false
authorizationProvider授权提供程序的完全限定类名org.apache.pulsar.broker.authorization.PulsarAuthorizationProvider
brokerClientAuthenticationPluginPulsar代理使用的身份验证插件,用于对Pulsar brokers进行身份验证
brokerClientAuthenticationParametersPulsar代理用于对Pulsar Brokers进行身份验证的参数
brokerClientTrustCertsFilePathPulsar代理用于对Pulsar Brokers进行身份验证的可信证书的路径
superUserRoles“超级用户”的角色名,这意味着它们将能够执行所有管理
forwardAuthorizationCredentialsWhether client authorization credentials are forwared to the broker for re-authorization. Authentication must be enabled via authenticationEnabled=true for this to take effect.false
maxConcurrentInboundConnectionsMax concurrent inbound connections. The proxy will reject requests beyond that.10000
maxConcurrentLookupRequestsMax concurrent outbound connections. The proxy will error out requests beyond that.50000
tlsEnabledInProxy是否为代理启用TLSfalse
tlsEnabledWithBroker与Pulsar Brokers通信时是否启用TLSfalse
tlsCertificateFilePathTLS证书文件的路径
tlsKeyFilePathTLS私钥文件的路径
tlsTrustCertsFilePath受信任的TLS证书pem文件的路径
tlsHostnameVerificationEnabled当代理与brokers建立TLS连接时是否验证主机名false
tlsRequireTrustedClientCertOnConnectWhether client certificates are required for TLS. Connections are rejected if the client certificate isn’t trusted.false
tlsProtocolsSpecify the tls protocols the broker will use to negotiate during TLS Handshake. Multiple values can be specified, separated by commas. Example:- TLSv1.2, TLSv1.1, TLSv1
tlsCiphersSpecify the tls cipher the broker will use to negotiate during TLS Handshake. Multiple values can be specified, separated by commas. Example:- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
tokenSecretKeyConfigure the secret key to be used to validate auth tokens. The key can be specified like: tokenSecretKey=data:base64,xxxxxxxxx or tokenSecretKey=file:///my/secret.key
tokenPublicKeyConfigure the public key to be used to validate auth tokens. The key can be specified like: tokenPublicKey=data:base64,xxxxxxxxx or tokenPublicKey=file:///my/secret.key
tokenAuthClaimSpecify the token claim that will be used as the authentication “principal” or “role”. The “subject” field will be used if this is left blank

ZooKeeper

ZooKeeper handles a broad range of essential configuration- and coordination-related tasks for Pulsar. The default configuration file for ZooKeeper is in the conf/zookeeper.conf file in your Pulsar installation. The following parameters are available:

NameDescription默认值
tickTimeThe tick is the basic unit of time in ZooKeeper, measured in milliseconds and used to regulate things like heartbeats and timeouts. tickTime is the length of a single tick.2000
initLimitThe maximum time, in ticks, that the leader ZooKeeper server allows follower ZooKeeper servers to successfully connect and sync. The tick time is set in milliseconds using the tickTime parameter.10
syncLimitThe maximum time, in ticks, that a follower ZooKeeper server is allowed to sync with other ZooKeeper servers. The tick time is set in milliseconds using the tickTime parameter.5
dataDirThe location where ZooKeeper will store in-memory database snapshots as well as the transaction log of updates to the database.data/zookeeper
clientPortThe port on which the ZooKeeper server will listen for connections.2181
autopurge.snapRetainCountIn ZooKeeper, auto purge determines how many recent snapshots of the database stored in dataDir to retain within the time interval specified by autopurge.purgeInterval (while deleting the rest).3
autopurge.purgeIntervalThe time interval, in hours, by which the ZooKeeper database purge task is triggered. Setting to a non-zero number will enable auto purge; setting to 0 will disable. Read this guide before enabling auto purge.1
maxClientCnxnsThe maximum number of client connections. Increase this if you need to handle more ZooKeeper clients.60

In addition to the parameters in the table above, configuring ZooKeeper for Pulsar involves adding a server.N line to the conf/zookeeper.conf file for each node in the ZooKeeper cluster, where N is the number of the ZooKeeper node. Here’s an example for a three-node ZooKeeper cluster:

  1. server.1=zk1.us-west.example.com:2888:3888
  2. server.2=zk2.us-west.example.com:2888:3888
  3. server.3=zk3.us-west.example.com:2888:3888

We strongly recommend consulting the ZooKeeper Administrator’s Guide for a more thorough and comprehensive introduction to ZooKeeper configuration