Skip to content

启动 arana & 配置导入

Zonglei Dong edited this page Jun 24, 2023 · 1 revision

本地启动调试 arana

通过源码方式启动 Arana,连接本地 MySQL 数据库:

  • 1、首先确保本地 MySQL 服务正常运行:配置host: 127.0.0.1 arana-mysql

    注:在/etc/hosts里添加行127.0.0.1 arana-mysql,重启或使用相应命令使修改hosts生效

  • 2、使用 arana/scripts/sharding.sql 初始化 employee 测试数据库;

  • 3、编辑 arana/conf/config.yaml 配置文件:修改 username、password、port 等信息与本地 MySQL 一致

  • 4、配置 IDE 调试环境,信息如下:Program arguments:start -c ./conf/bootstrap.yaml

image

  • 5、通过 IDE debug 模式启动服务;

  • 6、mycli 连接 Arana 服务:mycli -h127.0.0.1 -P13306 -udksl employees -p123456

  • 7、mycli 发送命令到 Arana,通过 IDE debug 工具调试源代码。

导入本地配置到配置中心

  • 1、修改 arana/conf/bootstrap.yaml 配置如下,以 etcd 配置中心为例:
config:
   name: etcd
   options:
     endpoints: "http://localhost:2379"
  • 2、修改 arana/conf/config.yaml 配置文件,调整为正确配置内容;

  • 3、启动 etcd 服务,确保 etcd 服务可以正常连通;

  • 4、通过 IDE 导入配置文件到配置中心(etcd),IDE 配置如下: Program arguments:import -c ./conf/bootstrap.yaml -s ./conf/config.yaml

image