Skip to content

Instantly share code, notes, and snippets.

@omegaml
Last active August 31, 2021 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omegaml/82b2fd3457b5108baaa4f89df95ca6a9 to your computer and use it in GitHub Desktop.
Save omegaml/82b2fd3457b5108baaa4f89df95ca6a9 to your computer and use it in GitHub Desktop.
Connect omegaml to Atlas Service

Create MongoDB on MongoDB Atlas service

  1. Sign up to Atlasdb https://cloud.mongodb.com/

  2. Create new MongoDB

  3. Connect > Connect your application > Python > 3.4

  4. Copy/paste the first server URL:

    e.g.

    mongodb://foo:<password>@cluster0-shard-00-00.q35ff.azure.mongodb.net:27017,cluster0-shard-00-01.q35ff.azure.mongodb.net:27017,cluster0-shard-00-02.q35ff.azure.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-kcs9h8-shard-0&authSource=admin&retryWrites=true&w=majority

    => copy

    mongodb://foo:<password>@cluster0-shard-00-00.q35ff.azure.mongodb.net:27017

  5. Note the shard name

    e.g.

    mongodb://foo:<password>@cluster0-shard-00-00.q35ff.azure.mongodb.net:27017,cluster0-shard-00-01.q35ff.azure.mongodb.net:27017,cluster0-shard-00-02.q35ff.azure.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-kcs9h8-shard-0&authSource=admin&retryWrites=true&w=majority

    => copy

    replicaSet=atlas-kcs9h8-shard-0

Connect omega-ml

  1. Create a config.yml

    # note the database name at the end (/omegaml)
    OMEGA_MONGO_URL: mongodb://foo:<password>@cluster0-shard-00-00.q35ff.azure.mongodb.net:27017/omegaml
    OMEGA_MONGO_SSL_KWARGS:
       replicaSet: atlas-kcs9h8-shard-0
       ssl: true
    OMEGA_LOCAL_RUNTIME: true
    
  2. Run omegaml commands from cli or Python

    $ om datasets list
    $ om datasets put /path/to/file.csv mydataset
    $ om datasets get mydataset /path/to/file.csv
    

    Note you can also run om runtime commands, however all execution will be local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment