Development Environment for YugabyteDB on Mac M1
Setting up a development environment for YugabyteDB on a Mac M1
Here’s a very quick way to set up YugabyteDB on your Mac for functional testing. It assumes you already have Homebrew installed.
brew tap yugabyte/yugabytedb
brew install yugabytedb
In the future, you can upgrade the version by running this:
brew upgrade yugabytedb
Verify the installation and check the version:
yugabyted version
Set up local networking:
sudo ifconfig lo0 alias 127.0.0.2
sudo ifconfig lo0 alias 127.0.0.3
Then you can set up a three-node YugabyteDB cluster. Change the data directory if you’d like.
yugabyted start --cloud_location cloud1.datacenter1.rack1 --base_dir /tmp/data1 --advertise_address 127.0.0.1
yugabyted start --cloud_location cloud1.datacenter2.rack1 --base_dir /tmp/data2 --advertise_address 127.0.0.2 --join 127.0.0.1
yugabyted start --cloud_location cloud1.datacenter3.rack1 --base_dir /tmp/data3 --advertise_address 127.0.0.3 --join 127.0.0.1
After a few seconds, you should see output like the following:
๐ YugabyteDB started successfully! To load a sample dataset, try 'yugabyted demo'.
Generate test data:
yugabyted demo connect --base_dir /tmp/data1
When that command is complete, you will be in the ysql shell.
yb_demo_northwind=#
The output will indicate that the data is within yb_demo_northwind, but it’s actually within yugabyte. (refย https://github.com/yugabyte/yugabyte-db/issues/14586). View the generated data.
\c yugabyte
\dt
Now you can run queries and explore other YugabyteDB functionality.
Stop the yugabyted process when you are done experimenting.
yugabyted stop --base_dir /tmp/data1
yugabyted stop --base_dir /tmp/data2
yugabyted stop --base_dir /tmp/data3