Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Connecting R and Vitess with ADBC

Instructions

Tip

If you already have a Vitess instance running, skip the steps to set up and clean up Vitess.

Prerequisites

  1. Install R

  2. Install dbc

  3. Install R packages adbcdrivermanager, arrow, and tibble:

    install.packages(c("adbcdrivermanager", "arrow", "tibble"))

Set up Vitess

  1. Install Docker

  2. Start a Vitess instance:

    docker run -d --rm --name=vttestserver \
        -p 33574:33574 \
        -p 33575:33575 \
        -p 33577:33577 \
        -e PORT=33574 \
        -e KEYSPACES=test,unsharded \
        -e NUM_SHARDS=2,1 \
        -e MYSQL_MAX_CONNECTIONS=70000 \
        -e MYSQL_BIND_HOST=0.0.0.0 \
        -e VTCOMBO_BIND_HOST=0.0.0.0 \
        vitess/vttestserver:mysql80

    Wait a few moments before continuing to the next step to allow the Vitess container to fully initialize.

Connect to Vitess

  1. Install the MySQL ADBC driver:

    dbc install mysql
  2. Customize the R script main.R as needed

  3. Run the R script:

    Rscript main.R

Clean up

Stop the Docker container running Vitess:

docker stop vttestserver