巨大的建筑,总是由一木一石叠起来的,我们何妨做做这一木一石呢?我时常做些零碎事,就是为此。
这是对的,但是我没有说过这句话! —— 鲁迅
brew 是mac系统的安装包工具。类似于 yum 或者 apt-get等。
brew 安装的包路径是怎样的呢。下面以安装kafka举例说明。
安装kafka
brew install kafka
执行结果
######################################################################## 100.0%
==> Pouring kafka-2.0.0.highsierra.bottle.tar.gz
==> Caveats
To have launchd start kafka now and restart at login:
brew services start kafka
Or, if you don't want/need a background service you can just run:
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
==> Summary
🍺 /usr/local/Cellar/kafka/2.0.0: 160 files, 46.8MB
安装路径
从执行结果最后一句,可以看到安装到了 /usr/local/Cellar/kafka/2.0.0 下面,目录下面的结果如下
/usr/local/Cellar/kafka/2.0.0 ll
total 88
-rw-r--r-- 1 xinaozhihuiwuliu staff 1.6K 3 6 08:58 INSTALL_RECEIPT.json
-rw-r--r-- 1 xinaozhihuiwuliu staff 28K 7 24 2018 LICENSE
-rw-r--r-- 1 xinaozhihuiwuliu staff 336B 7 24 2018 NOTICE
drwxr-xr-x 32 xinaozhihuiwuliu staff 1.0K 3 6 08:58 bin
-rw-r--r-- 1 xinaozhihuiwuliu staff 768B 3 6 08:58 homebrew.mxcl.kafka.plist
drwxr-xr-x 5 xinaozhihuiwuliu staff 160B 7 24 2018 libexec
这里有最重要的目录bin,里面便是执行文件.
- 也就是说,安装的文件夹是 usr/local/Cellar 下面*
使用路径
一般使用的路径是 /usr/local/bin, 到该目录下,查看一下;
/usr/local/bin ll | grep kafka
lrwxr-xr-x 1 xinaozhihuiwuliu admin 45B 3 6 08:58 connect-distributed -> ../Cellar/kafka/2.0.0/bin/connect-distributed
lrwxr-xr-x 1 xinaozhihuiwuliu admin 44B 3 6 08:58 connect-standalone -> ../Cellar/kafka/2.0.0/bin/connect-standalone
lrwxr-xr-x 1 xinaozhihuiwuliu admin 36B 3 6 08:58 kafka-acls -> ../Cellar/kafka/2.0.0/bin/kafka-acls
lrwxr-xr-x 1 xinaozhihuiwuliu admin 51B 3 6 08:58 kafka-broker-api-versions -> ../Cellar/kafka/2.0.0/bin/kafka-broker-api-versions
lrwxr-xr-x 1 xinaozhihuiwuliu admin 39B 3 6 08:58 kafka-configs -> ../Cellar/kafka/2.0.0/bin/kafka-configs
lrwxr-xr-x 1 xinaozhihuiwuliu admin 48B 3 6 08:58 kafka-console-consumer -> ../Cellar/kafka/2.0.0/bin/kafka-console-consumer
lrwxr-xr-x 1 xinaozhihuiwuliu admin 48B 3 6 08:58 kafka-console-producer -> ../Cellar/kafka/2.0.0/bin/kafka-console-producer
lrwxr-xr-x 1 xinaozhihuiwuliu admin 47B 3 6 08:58 kafka-consumer-groups -> ../Cellar/kafka/2.0.0/bin/kafka-consumer-groups
lrwxr-xr-x 1 xinaozhihuiwuliu admin 50B 3 6 08:58 kafka-consumer-perf-test -> ../Cellar/kafka/2.0.0/bin/kafka-consumer-perf-test
lrwxr-xr-x 1 xinaozhihuiwuliu admin 49B 3 6 08:58 kafka-delegation-tokens -> ../Cellar/kafka/2.0.0/bin/kafka-delegation-tokens
lrwxr-xr-x 1 xinaozhihuiwuliu admin 46B 3 6 08:58 kafka-delete-records -> ../Cellar/kafka/2.0.0/bin/kafka-delete-records
lrwxr-xr-x 1 xinaozhihuiwuliu admin 40B 3 6 08:58 kafka-dump-log -> ../Cellar/kafka/2.0.0/bin/kafka-dump-log
lrwxr-xr-x 1 xinaozhihuiwuliu admin 40B 3 6 08:58 kafka-log-dirs -> ../Cellar/kafka/2.0.0/bin/kafka-log-dirs
lrwxr-xr-x 1 xinaozhihuiwuliu admin 44B 3 6 08:58 kafka-mirror-maker -> ../Cellar/kafka/2.0.0/bin/kafka-mirror-maker
lrwxr-xr-x 1 xinaozhihuiwuliu admin 58B 3 6 08:58 kafka-preferred-replica-election -> ../Cellar/kafka/2.0.0/bin/kafka-preferred-replica-election
lrwxr-xr-x 1 xinaozhihuiwuliu admin 50B 3 6 08:58 kafka-producer-perf-test -> ../Cellar/kafka/2.0.0/bin/kafka-producer-perf-test
lrwxr-xr-x 1 xinaozhihuiwuliu admin 51B 3 6 08:58 kafka-reassign-partitions -> ../Cellar/kafka/2.0.0/bin/kafka-reassign-partitions
lrwxr-xr-x 1 xinaozhihuiwuliu admin 52B 3 6 08:58 kafka-replica-verification -> ../Cellar/kafka/2.0.0/bin/kafka-replica-verification
lrwxr-xr-x 1 xinaozhihuiwuliu admin 41B 3 6 08:58 kafka-run-class -> ../Cellar/kafka/2.0.0/bin/kafka-run-class
lrwxr-xr-x 1 xinaozhihuiwuliu admin 44B 3 6 08:58 kafka-server-start -> ../Cellar/kafka/2.0.0/bin/kafka-server-start
lrwxr-xr-x 1 xinaozhihuiwuliu admin 43B 3 6 08:58 kafka-server-stop -> ../Cellar/kafka/2.0.0/bin/kafka-server-stop
lrwxr-xr-x 1 xinaozhihuiwuliu admin 57B 3 6 08:58 kafka-streams-application-reset -> ../Cellar/kafka/2.0.0/bin/kafka-streams-application-reset
lrwxr-xr-x 1 xinaozhihuiwuliu admin 38B 3 6 08:58 kafka-topics -> ../Cellar/kafka/2.0.0/bin/kafka-topics
lrwxr-xr-x 1 xinaozhihuiwuliu admin 51B 3 6 08:58 kafka-verifiable-consumer -> ../Cellar/kafka/2.0.0/bin/kafka-verifiable-consumer
lrwxr-xr-x 1 xinaozhihuiwuliu admin 51B 3 6 08:58 kafka-verifiable-producer -> ../Cellar/kafka/2.0.0/bin/kafka-verifiable-producer
lrwxr-xr-x 1 xinaozhihuiwuliu admin 33B 3 6 08:58 trogdor -> ../Cellar/kafka/2.0.0/bin/trogdor
lrwxr-xr-x 1 xinaozhihuiwuliu admin 54B 3 6 08:58 zookeeper-security-migration -> ../Cellar/kafka/2.0.0/bin/zookeeper-security-migration
lrwxr-xr-x 1 xinaozhihuiwuliu admin 48B 3 6 08:58 zookeeper-server-start -> ../Cellar/kafka/2.0.0/bin/zookeeper-server-start
lrwxr-xr-x 1 xinaozhihuiwuliu admin 47B 3 6 08:58 zookeeper-server-stop -> ../Cellar/kafka/2.0.0/bin/zookeeper-server-stop
lrwxr-xr-x 1 xinaozhihuiwuliu admin 41B 3 6 08:58 zookeeper-shell -> ../Cellar/kafka/2.0.0/bin/zookeeper-shell
该目录对cellar目录下面的bin下面的命令做了一个超链接.
配置路径
从执行结果看,应该是 /usr/local/etc 下面, 发现有kafka,查看该目录:
/usr/local/etc/kafka ll
total 136
-rw-r--r-- 1 xinaozhihuiwuliu admin 906B 3 6 08:58 connect-console-sink.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 909B 3 6 08:58 connect-console-source.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 5.2K 3 6 08:58 connect-distributed.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 883B 3 6 08:58 connect-file-sink.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 881B 3 6 08:58 connect-file-source.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.1K 3 6 08:58 connect-log4j.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 2.2K 3 6 08:58 connect-standalone.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.2K 3 6 08:58 consumer.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 4.6K 3 6 08:58 log4j.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.9K 3 6 08:58 producer.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 6.7K 3 6 08:58 server.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.0K 3 6 08:58 tools-log4j.properties
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.1K 3 6 08:58 trogdor.conf
-rw-r--r-- 1 xinaozhihuiwuliu admin 1.0K 3 6 08:58 zookeeper.properties
OK,配置文件找到了.