Home Cd software Running SingleStore on Apple Silicon

Running SingleStore on Apple Silicon

0

This guide will walk you through the installation Single store on your Apple Silicon machine for development purposes. SingleStore is working on establishing official support for development workloads only, which means that this solution involving UTM/QEMU is not officially tested or supported by SingleStore.

SingleStore is a modern database solution designed for rapid aggregation within your data-intensive applications. It is much faster to retrieve and aggregate data than traditional MySQL-based solutions. This has personally been a crucial part of my gaming-focused analytics platform, so let me explain who I am and why I wrote this guide.

I’m Charlie Joseph and I run a Minecraft Server Analysis platform called Analysis. I built Analyze because I ran and managed various gaming communities, and I felt frustrated with the complexity and memory of other solutions, so I built my own. Analytics is fundamental to understanding the growth of your game servers, and creating Analytics meant I knew I would be dealing with large volumes of data from launch. SingleStore has been a fantastic solution for quickly aggregating data, which led me to want to host it locally so I could experiment with it more.

Facility

For this guide we will create a Debian based virtual machine that will host our SingleStore database, for this you will need to download the Debian-ISO next to UTM to run our virtual machine with Apple Silicon.

Once you have downloaded these files, drag the UTM application in your Mac’s applications folder, then open the application.

Establishment

With the UTM application open, press the key + symbol present at the top of the application to create a new machine. So..

  1. Select the "Emulate" option followed by "Linux" option.
  2. Then select "Browse" and choose the Debian ISO we downloaded earlier and click "Continue".
  3. Now under "Architecture" ensure that x86_64 is selected and Standard PC (Q35+ICH9, 2009) (alias of pc-q35-7.0) (q35) is selected under "System".
  4. Below "Memory" it’s recommended by SingleStore to have at least 4GB of RAM selected, so I’d go with at least 4096. You can optionally specify how many CPU cores you want to allocate, but I left that as the default. Then press "Continue".
  5. For the disk space of our machines, it is recommended to allocate approximately 100GB however you can go slightly lower. Then press "Continue".
  6. Once you’re on the "Shared Directory" tap Continue again.
  7. Finally, you will be taken to "Summary" page where you can specify a name for the virtual machine I went with Single store for this guide. Then tick the Open virtual machine options checkbox and press "Save".

Enabling Networking

Now that our virtual machine is created and the settings page is open, we will configure networking so that our machine has access to the Internet. So..

  1. Select the "Network" sidebar tab.
  2. Under the "Network Mode" drop-down list select the Emulated VLAN option.
  3. Then press "Save".

Starting our machine

With our machine created and our network configured, it’s finally time to start booting it up so we can install our virtual machine. So..

  1. Press the start button next to your virtual machine.
  2. Once started, select the "Graphical Install” option.

Install Debian

Once the menu has loaded you will be greeted by a Debian 11 banner at the top. Once you see this…

  1. Select your language using the AT THE TOP and DOWN keys then press WALK IN to choose this option. I chose “English”.
  2. Then select your location and press WALK INI’m British so I opted for “United Kingdom”.
  3. Now select your keyboard layout and press WALK IN. I chose “British English”.
  4. You will have to wait about 5 minutes for the installation media to load until you see "Configure the network".
  5. Then choose the hostname you want to appear on your local network and press WALK IN. I chose “harleyquinn”.
  6. Once you see the "Domain Name" option, just press WALK IN.
  7. Next, you will be asked to create a password for the root user, as this is for development purposes, then press WALK IN. I chose “password”.
  8. You will now be asked to create a new user next to root:
    1. For the "Full Name" choose what you would like to be called.
    2. For the "Username" choose the username you want.
    3. For the "Password" choose the password to use, I went with the same as above.
    4. Finally press the WALK IN key.
  9. Now wait to see the "Partitions Disks" page. choose the Guided – use entire disk option and press WALK IN.
  10. Select the QEMU ATA HARD DISK option and press WALK IN.
  11. Select the All files in a partition and press Enter.
  12. Select the Finish partitioning and write changes to disk option and press WALK IN.
  13. Select the Yes option under "Write the changes to disk?" and press WALK IN.
  14. Now wait for the installation to complete, which takes about 10 minutes.

Configuring the package manager

Once the installation is complete, you will see the "Configure the package manager" screen, once you are here..

  1. Select Nope for the "Scan extra installation media" and press WALK IN.
  2. Select the location of your mirror using the AT THE TOP and DOWN keys then press WALK IN to choose this option. I chose “United Kingdom”.
  3. Below "Debian archive mirror" to assure deb.debian.org is selected and press WALK IN.
  4. For "HTTP proxy information” leave this field empty and press WALK IN.
  5. After a few minutes you will see the "Configuring popularity-contest" page, select Nope and press WALK IN.
  6. Then uncheck both Debian Desktop Environment, GNOME and standard system utilitiesand tick SSH server and press WALK IN.
  7. Now wait for the "Installation complete" message.

Eject ISO

Once the installation is complete, we can now eject the media like this.

  1. Select the CD icon in the top right and hover over CDs/DVDs.
  2. Then press the Eject button.
  3. Finally select Continue of the installer.

Configuring local port forwarding

To make configuration easier while allowing us to access our SingleStore instance locally from our Mac, we will configure the ports from our machine. To do this..

  1. Click the power icon on the top left to turn off the machine.
  2. Right-click on the virtual machine and select Edit.
  3. Go to the "Networking" tongue.
  4. Next to "Port Forward" select the new tab.
  5. Select 22 for the "Guest Port" and 2222 for the "Host Port" so we can SSH in locally and click save.
  6. Now do the same for the port 3306 (database) and 8080 for the SingleStores viewer. If you want to use a different port for any of these ports, be sure to only change the "Host Port" assess.
  7. Click now "Save" basically.

Single store configuration

Once our machine is installed and configured, we can finally start installing SingleStore. Press the start button next to the machine option. So..

  1. Click the start button to launch the machine.
  2. Once started, enter root for the username.
  3. Enter the password you created earlier.

Configuring SSH for our Mac terminal

Now that we’re logged in, we need to configure SSH to be able to paste from our Mac to our machine. To do this, you will need to type the following commands in the terminal:

  1. To run nano '/etc/ssh/sshd_config.
  2. To add PermitRootLogin yes to the file, then press CTRL + X then press Yes to save the file.
  3. Finally, type systemctl restart ssh to restart our SSH server.

Installing SingleStore

Now that we’ve enabled SSH, open your Mac’s terminal (you can use CMD + SPACE then typing "Terminal" to do this). So..

  1. To run ssh -p 2222 root@localhost (or change 2222 for the other SSH port we configured earlier).
  2. Enter your password that you set up earlier and press WALK IN.

Now that we’re connected, let’s get started:

  1. To run apt -y install apt-transport-https gnupg to install our base packages.
  2. So wget -O - 'https://release.memsql.com/release-aug2018.gpg' 2>/dev/null | apt-key add - && apt-key list to add the SingleStore repository.
  3. So echo "deb [arch=amd64] https://release.memsql.com/production/debian memsql main" | tee /etc/apt/sources.list.d/memsql.list to add the package.
  4. To finish apt update && apt -y install singlestoredb-toolbox singlestore-client singlestoredb-studio to install SingleStore.

Creation of our cluster

With SingleStore added, we can finally create our new cluster. To do this, go to your SingleStore Portal and log in. Next..

  1. Click on "Org:" on the left.
  2. Select the "On-Prem Licenses" option.
  3. In your terminal, run LICENSE_KEY= followed by the license key found under "Free License" on the SingleStore portal.
  4. Now let’s set up a database password using LOCAL_PASSWORD= followed by the chosen password.
  5. Run now sdb-deploy cluster-in-a-box --license $LICENSE_KEY --version 7.8 --password $LOCAL_PASSWORD --bind-address 0.0.0.0 to install our cluster.
  6. In the prompts, type y and y again for both options.

Configure our cluster

Now that our cluster has been created, we need to make sure that it starts on boot alongside our cluster starting now. What can be done like this…

  1. To run systemctl enable singlestoredb-studio.service
  2. To run systemctl start singlestoredb-studio.service

Login to SingleStore Studio

With our cluster configured and started, go to your browser and navigate to http://localhost:8080 (or another port if previously configured). Once here, we’ll have to…

  1. Select "Add Existing Cluster".
  2. Type 0.0.0.0 for the "IP Address".
  3. Type 3306 for the "Port".
  4. For login credentials.
    1. Use root for the "Username".
    2. Use the password you specified for LOCAL_PASSWORD above.
  5. Select Development for the "Type".
  6. For the final details…
    1. Choose a custom name for it.
    2. Optionally specify a memorable description.
  7. Finally, click "Create".

You can now connect to your cluster for the online portal and connect locally to your database using the port 3306.

This was a long blog post, if this helped you be sure to tweet me @heychazza.