Run on Android Platforms
Since v0.4.0, GreptimeDB supports running on Android platforms with ARM64 CPU and Android API level >= 23.
Install terminal emulator on Android
You can install Termux from GitHub release page.
Download GreptimeDB Android binary.
bash
1. curl -sOL https://github.com/GreptimeTeam/greptimedb/releases/download/v0.4.0/greptime-android-arm64-v0.4.0.tar.gz
2. tar zxvf ./greptime-android-arm64-v0.4.0.tar.gz
3. ./greptime -V
If binary’s downloaded correctly, the command is expected to print:
1. greptimedb
2. branch: HEAD
3. commit: c9c2b3c91f273ff605782dbb8a4873e511dfea10
4. dirty: false
5. version: 0.4.0
Create GreptimeDB configuration file
You can create a minimal configuration file that allows access from local network.
bash
1. DATA_DIR="$(pwd)/greptimedb-data"
2. mkdir -p ${DATA_DIR}
4. cat <<EOF > ./config.toml
5. [http]
6. addr = "0.0.0.0:4000"
8. [grpc]
9. addr = "0.0.0.0:4001"
11. [mysql]
12. addr = "0.0.0.0:4002"
14. [storage]
15. data_home = "${DATA_DIR}"
16. type = "File"
17. EOF
Start GreptimeDB from command line
bash
1. ./greptime --log-dir=$(pwd)/logs standalone start -c ./config.toml
Connect to GreptimeDB running on Android
You can find the IP address of your Android device from system settings or
ifconfig.
You can now connect to the GreptimeDB instance running on Android from another device with MySQL client installed.
bash
1. mysql -h <ANDROID_DEVICE_IP_ADDR> -P 4002
And play like on any other platforms!
1. Welcome to the MySQL monitor. Commands end with ; or \g.
2. Your MySQL connection id is 8
3. Server version: 5.1.10-alpha-msql-proxy Greptime
5. Copyright (c) 2000, 2023, Oracle and/or its affiliates.
7. Oracle is a registered trademark of Oracle Corporation and/or its
8. affiliates. Other names may be trademarks of their respective
9. owners.
11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
13. mysql> CREATE TABLE monitor (env STRING, host STRING, ts TIMESTAMP, cpu DOUBLE DEFAULT 0, memory DOUBLE, TIME INDEX (ts), PRIMARY KEY(env,host));
14. Query OK, 0 rows affected (0.14 sec)
16. mysql> INSERT INTO monitor(ts, env, host, cpu, memory) VALUES
17. -> (1655276557000,'prod', 'host1', 66.6, 1024),
18. -> (1655276557000,'prod', 'host2', 66.6, 1024),
19. -> (1655276557000,'prod', 'host3', 66.6, 1024),
20. -> (1655276558000,'prod', 'host1', 77.7, 2048),
21. -> (1655276558000,'prod', 'host2', 77.7, 2048),
22. -> (1655276558000,'test', 'host3', 77.7, 2048),
23. -> (1655276559000,'test', 'host1', 88.8, 4096),
24. -> (1655276559000,'test', 'host2', 88.8, 4096),
25. -> (1655276559000,'test', 'host3', 88.8, 4096);
26. Query OK, 9 rows affected (0.14 sec)
28. mysql>
29. mysql> select * from monitor where env='test' and host='host3';
30. +------+-------+---------------------+------+--------+
31. | env | host | ts | cpu | memory |
32. +------+-------+---------------------+------+--------+
33. | test | host3 | 2022-06-15 15:02:38 | 77.7 | 2048 |
34. | test | host3 | 2022-06-15 15:02:39 | 88.8 | 4096 |
35. +------+-------+---------------------+------+--------+
36. 2 rows in set (0.20 sec)
