Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Last active June 15, 2016 16:38
Show Gist options
  • Save simonewebdesign/bb607122a1b60760f414 to your computer and use it in GitHub Desktop.
Save simonewebdesign/bb607122a1b60760f414 to your computer and use it in GitHub Desktop.
An OrientDB session using joaodubas/orientdb Docker repository
root@cc4cb3a931ad:/usr/local/src/orientdb# ./bin/console.sh
OrientDB console v.2.0.12 (build UNKNOWN@r; 2015-07-01 11:28:05+0000) www.orientechnologies.com
Type 'help' to display all the supported commands.
2015-07-20 15:36:35:427 WARNING Not enough physical memory available for DISKCACHE: 2,001MB (heap=455MB). Set lower Maximum Heap (-Xmx setting on JVM) and restart OrientDB. Now running with DISKCACHE=256MB [orientechnologies]
Installing extensions for GREMLIN language v.2.6.0
orientdb> help
AVAILABLE COMMANDS:
* alter class <command-text> Alter a class in the database schema
* alter cluster <command-text> Alters a cluster in the current database. The cluster can be physical or memory
* alter database <command-text> Alter a database property
* alter property <command-text> Alter a class property in the database schema
* backup database <options> Backup a database
* begin Begins a transaction. All the changes will remain local
* browse class <class-name> Browse all records of a class
* browse cluster <cluster-name> Browse all records of a cluster
* check database <options> Check database integrity
* move vertex <command-text> Move vertices to another position (class/cluster)
* cluster status Displays the status of the cluster nodes
* commit Commits transaction changes to the database
* compare databases <db1-url> <db2-url> <user-name> <user-password> <detect-mapping-data>Compare two databases
* config Return all the configuration values
* config get <config-name> Return the value of a configuration value
* config set <config-name> <config-value> Change the value of a configuration value
* connect <url> <user> <password> Connect to a database or a remote Server instance
* copy database <db-name> <db-user> <db-password> <server-name> <engine-name>Copy a database to a remote server
* create class <command-text> Create a class
* create cluster <command-text> Create a new cluster in the current database. The cluster can be physical or memory
* create database <database-url> <user> <password> <storage-type> <db-type>Create a new database
* create edge <command-text> Create a new edge into the database
* create function <command-text> Create a stored function
* create index <command-text> Create an index against a property
* create link <command-text> Create a link from a JOIN
* create property <command-text> Create a property
* create vertex <command-text> Create a new vertex into the database
* current Display current record
* declare intent <Intent name> Declare an intent
* delete <command-text> Delete records from the database
* dictionary get <key> Loook up a record using the dictionary. If found, set it as the current record
* dictionary put <key> <record-id> Insert or modify an entry in the database dictionary. The entry is comprised of key=String, value=record-id
* dictionary remove <key> Remove the association in the dictionary
* disconnect Disconnect from the current database
* display raw record <rid> Display a record as raw bytes
* display record <number> Display current record attributes
* drop class <command-text> Remove a class from the schema
* drop cluster <cluster-name> Remove a cluster in the current database. The cluster can be physical or memory
* drop database <storage-type> Delete the current database
* drop database <database-url> <user> <password> <storage-type> Delete the specified database
* drop index <command-text> Remove an index
* drop property <command-text> Remove a property from a class
* eval <text> Evaluate a predicate against current record
* explain <command-text> Explain how a command is executed profiling it
* export database <options> Export a database
* export record <format> <options> Export the current record in the requested format
* export schema <output-file> Export a database schema
* find references <command-text> Find all references the target record id @rid
* flush database <storage-type> Flushes all database content to the disk
* freeze cluster <cluster-name> <storage-type> Freeze clusters and flush on the disk
* freeze database <storage-type> Freeze database and flush on the disk
* gc Force calling of JVM Garbage Collection
* get <property-name> Return the value of a property
* grant <text> Grant privileges to a role
* gremlin <script-text> Execute a GREMLIN script
* import database <options> Import a database into the current one
* info Display information about the database
* info class <class-name> Display the schema of a class
* insert <command-text> Insert a new record into the database
* js <text> Execute javascript commands in the console
* jss <text> Execute javascript commands against a remote server
* list classes Display all the configured classes
* list clusters Display all the configured clusters
* list databases List all the databases available on the connected server
* list indexes Display all indexes
* list properties Display the database properties
* load record <record-id> Load a record in memory and set it as the current
* load record <record-id> <fetch-plan> Load a record in memory using passed fetch plan
* move <text> Move from current record by evaluating a predicate against current record
* next Move the current record cursor to the next one in result set
* prev Move the current record cursor to the previous one in result set
* profiler <profiler command> Execute a command against the profiler
* properties Return all configured properties
* pwd Display the current path
* rebuild index <command-text> Rebuild an index if it is automatic
* release cluster <cluster-name> <storage-type> Release cluster after freeze
* release database <storage-type> Release database after freeze
* reload record <record-id> Reload a record and set it as the current one
* reload record <record-id> <fetch-plan> Reloads a record using passed fetch plan
* reload schema Reload the database schema
* repair database <options> Repair database structure
* restore database <options> Restore a database into the current one
* revoke <text> Revoke privileges to a role
* rollback Rolls back transaction changes to the previous state
* script <text> Execute a script containing multiple commands separated by ; or new line
* select <query-text> Execute a query against the database and display the results
* set <property-name> <property-value> Change the value of a property
* sleep Sleep X milliseconds
* transactional <command-text> Executes a command inside a transaction
* traverse <query-text> Traverse records and display the results
* truncate class <text> Truncate the class content in the current database
* truncate cluster <text> Truncate the cluster content in the current database
* truncate record <text> Truncate a record deleting it at low level
* update <command-text> Update records in the database
* upgrade graph Migrates graph from OMVRBTree to ORidBag
* help Print this help
* exit Close the console
orientdb> list databases
Not connected to the Server instance. You've to connect to the Server using server's credentials (look at orientdb-*server-config.xml file)
orientdb> connect remote:localhost root 0r13ntDB
Connecting to remote Server instance [remote:localhost] with user 'root'...OK
orientdb {server=remote:localhost/}> list databases
Found 1 databases:
* GratefulDeadConcerts (plocal)
orientdb {server=remote:localhost/}> classes
No database selected yet.
orientdb {server=remote:localhost/}> connect remote:localhost/GratefulDeadConcerts admin admin
Disconnecting from remote server [remote:localhost/]...
OK
Connecting to database [remote:localhost/GratefulDeadConcerts] with user 'admin'...OK
orientdb {db=GratefulDeadConcerts}> classes
CLASSES
----------------------------------------------+------------------------------------+------------+----------------+
NAME | SUPERCLASS | CLUSTERS | RECORDS |
----------------------------------------------+------------------------------------+------------+----------------+
_studio | | 12 | 0 |
E | | 10 | 0 |
followed_by | E | 11 | 7047 |
OFunction | | 7 | 0 |
OIdentity | | - | 0 |
ORestricted | | - | 0 |
ORIDs | | 6 | 0 |
ORole | OIdentity | 4 | 3 |
OSchedule | | 8 | 0 |
OTriggered | | - | 0 |
OUser | OIdentity | 5 | 3 |
V | | 9 | 809 |
----------------------------------------------+------------------------------------+------------+----------------+
TOTAL = 12 7862 |
----------------------------------------------+------------------------------------+------------+----------------+
orientdb {db=GratefulDeadConcerts}> create class Student
Class created successfully. Total classes in database now: 13
orientdb {db=GratefulDeadConcerts}> create property Student.name string
Property created successfully with id=1
orientdb {db=GratefulDeadConcerts}> create property Student.surname string
Property created successfully with id=2
orientdb {db=GratefulDeadConcerts}> create property Student.birthDate date
Property created successfully with id=3
orientdb {db=GratefulDeadConcerts}> info class
!Wrong syntax. If you're using a file make sure all commands are delimited by semicolon (;) or a linefeed (\n)
Expected: info class <class-name>
Where:
* class-name The name of the class
!Unrecognized command: 'info class'
orientdb {db=GratefulDeadConcerts}> info class Student
Class................: Student
Default cluster......: student (id=13)
Supported cluster ids: [13]
Cluster selection....: round-robin
PROPERTIES
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+----------+
NAME | TYPE | LINKED TYPE/CLASS | MANDATORY | READONLY | NOT NULL | MIN | MAX | COLLATE |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+----------+
name | STRING | null | false | false | false | | | default |
birthDate | DATE | null | false | false | false | | | default |
surname | STRING | null | false | false | false | | | default |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+----------+
orientdb {db=GratefulDeadConcerts}> alter property Student.name min 3
Property updated successfully
orientdb {db=GratefulDeadConcerts}> browse class OUser
----+----+------+------+-------------------------------------------------------------------------+------+-----
# |@RID|@CLASS|name |password |status|roles
----+----+------+------+-------------------------------------------------------------------------+------+-----
0 |#5:0|OUser |admin |{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918|ACTIVE|[1]
1 |#5:1|OUser |reader|{SHA-256}3D0941964AA3EBDCB00CCEF58B1BB399F9F898465E9886D5AEC7F31090A0FB30|ACTIVE|[1]
2 |#5:2|OUser |writer|{SHA-256}B93006774CBDD4B299389A03AC3D88C3A76B460D538795BC12718011A909FBA5|ACTIVE|[1]
----+----+------+------+-------------------------------------------------------------------------+------+-----
orientdb {db=GratefulDeadConcerts}> display record 0
+-------------------------------------------------------------------------------------------------+
| Document - @class: OUser @rid: #5:0 @version: 1 |
+-------------------------------------------------------------------------------------------------+
| Name | Value |
+-------------------------------------------------------------------------------------------------+
| name | admin |
| password | {SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918 |
| status | ACTIVE |
| roles | [#4:0] |
+-------------------------------------------------------------------------------------------------+
$ /opt/orientdb/bin/console.sh
OrientDB console v.2.2.0-rc1 (build develop@ra77a0cff0252551933fe6fe87eeba93f02a0935e; 2016-05-05 10:50:34+0000) www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0
orientdb> CREATE DATABASE plocal:/opt/orientdb/databases/mm_dev_px_data_capture root pXPJJAmRpjfJKWqxuqCATpmG;
Creating database [plocal:mm_dev_px_data_capture] using the storage type [plocal]...
Database created successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment