如何在MacBook上安装NebulaGraph数据库?
在MacBook上安装NebulaGraph的可行方案
方法1:使用Docker(推荐)
这是跨平台部署最省心的方式,无需处理依赖或编译:
- 确保Mac已安装并运行Docker Desktop
- 拉取官方镜像:
docker pull vesoft/nebula-graph:latest - 创建专属Docker网络:
docker network create nebula-net - 编写
docker-compose.yml文件一键启动集群:
执行启动命令:version: '3.4' services: metad: image: vesoft/nebula-graph:latest command: nebula-metad --flagfile=/usr/local/nebula/etc/nebula-metad.conf ports: ["9559:9559", "19559:19559"] volumes: ["./data/meta:/usr/local/nebula/data/meta", "./logs/meta:/usr/local/nebula/logs/meta"] networks: [nebula-net] storaged: image: vesoft/nebula-graph:latest command: nebula-storaged --flagfile=/usr/local/nebula/etc/nebula-storaged.conf ports: ["9779:9779", "19779:19779"] volumes: ["./data/storage:/usr/local/nebula/data/storage", "./logs/storage:/usr/local/nebula/logs/storage"] depends_on: [metad] networks: [nebula-net] graphd: image: vesoft/nebula-graph:latest command: nebula-graphd --flagfile=/usr/local/nebula/etc/nebula-graphd.conf ports: ["9669:9669", "19669:19669"] volumes: ["./logs/graph:/usr/local/nebula/logs/graph"] depends_on: [metad, storaged] networks: [nebula-net] networks: nebula-net: {driver: bridge}docker-compose up -d - 连接控制台:
docker run --rm -ti --network nebula-net vesoft/nebula-console:latest -addr graphd -port 9669
方法2:源码编译安装
适合需要原生Mac环境的场景:
- 安装编译依赖:
# 安装Xcode命令行工具 xcode-select --install # 用Homebrew安装编译工具与依赖库 brew install cmake openssl boost gflags glog - 克隆NebulaGraph官方源码仓库,切换到目标版本分支(如v3.3.0):
git clone --depth 1 --branch v3.3.0 <官方源码仓库地址> - 编译并安装:
安装完成后,可在cd nebula-graph && mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) make -j$(sysctl -n hw.ncpu) sudo make install/usr/local/nebula/bin找到服务启动脚本,直接运行即可。
方法3:虚拟机运行Linux
如果要严格遵循官方Linux安装流程,可在Mac上安装VirtualBox/Parallels Desktop,部署Ubuntu/CentOS等Linux发行版,之后按照官方文档的RPM/DEB包方式安装。
内容的提问来源于stack exchange,提问作者randomv
相关产品推荐
相关产品推荐

