Home > Storage > PowerFlex > White Papers > Optimizing High Frequency Trading with Real Time Insights using Dell PowerFlex and NVIDIA - White Paper > KDB.AI installation
KDB.AI has two offerings:
In this solution, the KDB.AI server edition is installed on both the compute nodes.
There are certain pre-requisites to be met before KDB.AI is installed:
apt install python3-pip
pip install numpy
pip install pandas
pip install curl
After the pre-requisites are installed follow the steps to install the KDB.AI.
The KDB.AI Server Standard Edition license is limited to 24 cores. When running the
Docker container, if the machine contains more than 24 cores, adjust the Docker
run command to include --cpuset-cpus, for example --cpuset-cpus 1-24.
First you need to sign up for KDB.AI Server Edition:
1. Log in to the KX downloads portal.
2. Once authenticated, navigate to https://portal.dl.kx.com/auth/token.
3. Click the Add New Bearer token option.
Figure 8. Get bearer token
4. Click Copy Bearer.
5. Download the KDB.AI image by using the credentials provided after you register.
6. Log in to the docker registry in the downloads portal.
export USERNAME=<registered email id>
export BEARER=<Copied from KX downloads portal>
docker login portal.dl.kx.com -u $USERNAME -p $BEARER
docker pull portal.dl.kx.com/kdbai-db:latest
7. Download the KDB.AI license from the email that you have received after registration. Your license is either a k4.lic or kc.lic file and is needed to access your KDB.AI Server database.
8. Create the environment variable using the corresponding command depending on the format of your license.
9. On the machine where you need to run the KDB.AI, create a folder structure as
/vecdb
/vecdb/data
/vecdb/logs
10. Set permissions to read and write to these directories:
chmod 0777 vecdb/data vecdb/logs
Figure 9. Sample folder structure for KDB.AI
11. Run the docker container to start the kdb.ai server
root@node1:/home/core# docker run -p 8082:8082 -e KDB_LICENSE_B64 -e KXI_RT_LOG_PATH=/logs -v $PWD/kdb/vecdb/data:/data -v $PWD/kdb/vecdb/logs:/logs --cpuset-cpus 1-24 portal.dl.kx.com/kdbai-db:latest
INFO: Parse kdb+ license [kc.lic] from KDB_LICENSE_B64 environment variable
{"time":"2024-03-26T13:07:09.499z","component":"LOG","level":"DEBUG","message":"Loading src/pe.q"}
{"time":"2024-03-26T13:07:09.504z","component":"LOG","level":"DEBUG","message":"Loading src/timer.q"}
{"time":"2024-03-26T13:07:09.507z","component":"LOG","level":"DEBUG","message":"Loading src/event.q"}
{"time":"2024-03-26T13:07:09.507z","component":"LOG","level":"DEBUG","message":"Loading src/secure.q"}
{"time":"2024-03-26T13:07:09.509z","component":"LOG","level":"DEBUG","message":"Loading src/entitlements.q"}
{"time":"2024-03-26T13:07:09.510z","component":"LOG","level":"INFO","message":"KX Insights core extensions initialization complete"}
{"time":"2024-03-26T13:07:09.515z","component":"LOG","level":"DEBUG","message":"Loading src/dbg.k"}
{"time":"2024-03-26T13:07:09.516z","component":"LOG","level":"DEBUG","message":"Loading src/util.q"}
{"time":"2024-03-26T13:07:09.516z","component":"LOG","level":"DEBUG","message":"Loading src/util/num.q"}
{"time":"2024-03-26T13:07:09.520z","component":"LOG","level":"DEBUG","message":"Loading src/util/gen.q"}
{"time":"2024-03-26T13:07:09.531z","component":"LOG","level":"DEBUG","message":"Loading src/util/char.q"}
{"time":"2024-03-26T13:07:09.539z","component":"LOG","level":"DEBUG","message":"Loading src/os.q"}
{"time":"2024-03-26T13:07:09.548z","component":"LOG","level":"DEBUG","message":"Loading src/sockopt.q"}{"time":"2024-03-26T13:07:09.557z","component":"LOG","level":"DEBUG","message":"Loading src/log.q"}
{"time":"2024-03-26T13:07:09.562z","component":"LOG","level":"INFO","message":"[] Logging facade initialized"}
12. Check that the KDB.AI container is running:
root@node1:/home/core# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d989c1ded13 portal.dl.kx.com/kdbai-db:latest "/opt/kx/startq.sh" About a minute ago Up About a minute 0.0.0.0:8082->8082/tcp, :::8082->8082/tcp infallible_wescoff
13. Install the KDB.AI client to establish and verify the connection with the KDB.AI Server
pip install kdbai-client
import kdbai_client as kdbai
session = kdbai.Session(endpoint='http://localhost:8082')
session.list()
# expected response
[]
curl -H http://localhost:8082/api/v1/ready
# expected response
OK