|
| 1 | +<!--- |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, |
| 13 | + software distributed under the License is distributed on an |
| 14 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + KIND, either express or implied. See the License for the |
| 16 | + specific language governing permissions and limitations |
| 17 | + under the License. |
| 18 | +--> |
| 19 | +# Running Ballista on Raspberry Pi |
| 20 | + |
| 21 | +The Raspberry Pi single-board computer provides a fun and relatively inexpensive way to get started with distributed |
| 22 | +computing. |
| 23 | + |
| 24 | +These instructions have been tested using an Ubuntu Linux desktop as the host, and a |
| 25 | +[Raspberry Pi 4 Model B](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) with 4 GB RAM as the target. |
| 26 | + |
| 27 | +## Preparing the Raspberry Pi |
| 28 | + |
| 29 | +We recommend installing the 64-bit version of [Ubuntu for Raspberry Pi](https://ubuntu.com/raspberry-pi). |
| 30 | + |
| 31 | +The Rust implementation of Arrow does not work correctly on 32-bit ARM architectures |
| 32 | +([issue](https://github.com/apache/arrow-rs/issues/109)). |
| 33 | + |
| 34 | +## Cross Compiling DataFusion for the Raspberry Pi |
| 35 | + |
| 36 | +We do not yet publish official Docker images as part of the release process, although we do plan to do this in the |
| 37 | +future ([issue #228](https://github.com/apache/arrow-datafusion/issues/228)). |
| 38 | + |
| 39 | +Although it is technically possible to build DataFusion directly on a Raspberry Pi, it really isn't very practical. |
| 40 | +It is much faster to use [cross](https://github.com/rust-embedded/cross) to cross-compile from a more powerful |
| 41 | +desktop computer. |
| 42 | + |
| 43 | +Docker must be installed and the Docker daemon must be running before cross-compiling with cross. See the |
| 44 | +[cross](https://github.com/rust-embedded/cross) project for more detailed instructions. |
| 45 | + |
| 46 | +Run the following command to install cross. |
| 47 | + |
| 48 | +```bash |
| 49 | +cargo install cross |
| 50 | +``` |
| 51 | + |
| 52 | +From the root of the DataFusion project, run the following command to cross-compile for ARM 64 architecture. |
| 53 | + |
| 54 | +```bash |
| 55 | +cross build --release --target aarch64-unknown-linux-gnu |
| 56 | +``` |
| 57 | + |
| 58 | +It is even possible to cross-test from your desktop computer: |
| 59 | + |
| 60 | +```bash |
| 61 | +cross test --target aarch64-unknown-linux-gnu |
| 62 | +``` |
| 63 | + |
| 64 | +## Deploying the binaries to Raspberry Pi |
| 65 | + |
| 66 | +You should now be able to copy the executable to the Raspberry Pi using scp on Linux. You will need to change the IP |
| 67 | +address in these commands to be the IP address for your Raspberry Pi. The easiest way to find this is to connect a |
| 68 | +keyboard and monitor to the Pi and run `ifconfig`. |
| 69 | + |
| 70 | +```bash |
| 71 | +scp ./target/aarch64-unknown-linux-gnu/release/ballista-scheduler ubuntu@10.0.0.186: |
| 72 | +scp ./target/aarch64-unknown-linux-gnu/release/ballista-executor ubuntu@10.0.0.186: |
| 73 | +``` |
| 74 | + |
| 75 | +Finally, ssh into the Pi and make the binaries executable: |
| 76 | + |
| 77 | +```bash |
| 78 | +ssh ubuntu@10.0.0.186 |
| 79 | +chmod +x ballista-scheduler ballista-executor |
| 80 | +``` |
| 81 | + |
| 82 | +It is now possible to run the Ballista scheduler and executor natively on the Pi. |
| 83 | + |
| 84 | +## Docker |
| 85 | + |
| 86 | +Using Docker's `buildx` cross-platform functionality, we can also build a docker image targeting ARM64 |
| 87 | +from any desktop environment. This will require write access to a Docker repository |
| 88 | +on [Docker Hub](https://hub.docker.com/) because the resulting Docker image will be pushed directly |
| 89 | +to the repo. |
| 90 | + |
| 91 | +```bash |
| 92 | +DOCKER_REPO=myrepo ./dev/build-ballista-docker-arm64.sh |
| 93 | +``` |
| 94 | + |
| 95 | +On the Raspberry Pi: |
| 96 | + |
| 97 | +```bash |
| 98 | +docker pull myrepo/ballista-arm64 |
| 99 | +``` |
| 100 | + |
| 101 | +Run a scheduler: |
| 102 | + |
| 103 | +```bash |
| 104 | +docker run -it myrepo/ballista-arm64 /ballista-scheduler |
| 105 | +``` |
| 106 | + |
| 107 | +Run an executor: |
| 108 | + |
| 109 | +```bash |
| 110 | +docker run -it myrepo/ballista-arm64 /ballista-executor |
| 111 | +``` |
| 112 | + |
| 113 | +Run the benchmarks: |
| 114 | + |
| 115 | +```bash |
| 116 | +docker run -it myrepo/ballista-arm64 \ |
| 117 | + /tpch benchmark --query=1 --path=/path/to/data --format=parquet \ |
| 118 | + --concurrency=24 --iterations=1 --debug --host=ballista-scheduler --port=50050 |
| 119 | +``` |
| 120 | + |
| 121 | +Note that it will be necessary to mount appropriate volumes into the containers and also configure networking |
| 122 | +so that the Docker containers can communicate with each other. This can be achieved using Docker compose or Kubernetes. |
| 123 | + |
| 124 | +## Kubernetes |
| 125 | + |
| 126 | +With Docker images built using the instructions above, it is now possible to deploy Ballista to a Kubernetes cluster |
| 127 | +running on one of more Raspberry Pi computers. Refer to the instructions in the [Kubernetes](kubernetes.md) chapter |
| 128 | +for more information, and remember to change the Docker image name to `myrepo/ballista-arm64`. |
0 commit comments