这里基本都是参考官网了,仅当做个笔录
MongoDB
1. 使用brew安装
警告⚠️ 不要直接 brew install mongodb
而是要执行下面两步。当然,执行之前还是要在终端设置代理。
brew tap mongodb/brew
brew install mongodb-community@5.0
安装的路径记录下(mac M1版):
/opt/homebrew/Cellar/mongodb-community/5.0.2
2. 启停mongo服务
To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /opt/homebrew/etc/mongod.conf
在安装成功的最后,有一段提示语如上。
就是告诉我们如何启动mongo服务的。两者的区别嘛,自己翻译吧
但是我直接像下面这样写,服务也能启动:
brew services start mongodb-community
brew services stop mongodb-community
以上就是一启一停
还可以使用如下命令检验是否启动成功:
brew services list
“You should see the service mongodb-community listed as started.”
3. 开始使用mongodb
输入以下指令
mongo
MySQL
1. 使用brew安装
brew install mysql
网上写还需要在 bash_profile文件中配置路径,但是我发现省了这一步,也不影响啊
2. 启停服务
brew services start mysql
brew services stop mysql
3. 开始使用mysql
mysql -u root -p
具体操作可参考我的另一篇文章
Redis
1. 使用brew安装
brew install redis
网上写还需要在 bash_profile文件中配置路径,但是我发现省了这一步,也不影响啊
2. 启停服务
brew services start redis
brew services stop redis
3. 开始使用redis
redis-cli
Elasticsearch
1.使用brew安装
这里是按照官网的标准和建议安装的。
见网上的文章,也有直接 brew install elasticsearch 这样安装的,但是,
我试了之后,报错。 可能是我mac m1系统的问题
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
2. 启停服务
To have launchd start elasticsearch now and restart at login:
brew services start/stop elasticsearch-full
Or, if you don't want/need a background service you can just run:
elasticsearch
3. 查看数据库安装信息
brew info elasticsearch
4. kibana
4.1 安装
brew tap elastic/tap
brew install elastic/tap/kibana-full
4.2 启停服务
brew services start/stop kibana-full
4.3 插件
我直接安装的Chrome浏览器插件,不需要修改kibana配置。直接安装插件就好,以下为插件地址
https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm?hl=zh-CN
https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm?hl=zh-CN安装好插件后,直接点击就可以连接上Elasticsearch。

就这些吧,随时补充
本文详细介绍了在Mac M1上通过Homebrew分别安装MongoDB、MySQL、Redis和Elasticsearch的方法,包括启动停止服务的命令和使用步骤,省略了不必要的配置步骤。


被折叠的 条评论
为什么被折叠?



