Configuration file
[OrientDB_Home]/config/orientdb-server-config.xml
Run server
[OrientDB_Home]/bin/server.sh
Run console
[OrientDB_Home]/bin/console.sh
Note: by default each database has "admin" user with password "admin".
Search
OrientDB tips
Class (Object descriptor) = Table
Property (Object attribute) = Column
Cluster: even though by default one class = one cluster, a class can relies on multiple clusters. Why? This is because you can spawn records physically in multiple places.
Clusters are "containers" in which Classes (tables) organize documents (records) .
A class can have one or more cluster (one by default).
Types of clusters:
- Physical: write on file system;
- Logic: use Phisical, but do not create files. It si slower than phisical;
- Memory: all informations in this clusters are not permanent, and will be lost at the end of the process or server. Memory cluster are usefull for applicative cache.
Select queries search in all clusters of a class by default.
Insert queries by default insert data in the default cluster.
We can refer to a specific cluster (so we can improve performance and launch parallel query):
select * from cluster:clusterName
Record id RID:
<cluster-id>:<cluster-position>
RID identifies uniquely a Document (a record) in the whole database (not just in a table). It is the physical position of the record inside the database.
- cluster-id is the id of the cluster. Each database can have a maximum of 32,767 clusters (2^15)
- cluster-position is the position of the record inside the cluster. Each cluster can handle up to 9,223,372,035,000,000,000 (2^63) records.
Example of use in query:
load record #12:4
Amazing performance:
"THE JOIN IS THE EVIL"
Looking for an ID at runtime, every time you execute a query and foreach record it could be very very expensive!
The first optimization is using indexes. That's true, indexes speed up searches but slow down INSERT, UPDATE and DELETE operations.
Furthermore they occupy substantial space on disk and memory.
In OrientDB a RID (RecordID) is the physical position of the record inside the database. This means that loading a record by its RID it's blazing fast with response time close to be constant O(1) even if the database grows. This is huge in the BigData age!
Unix alias
The alias command can be useful if you want to create a 'shortcut' to a command.
The format is alias name='command'
Example:
alias list='ls -la'
To make alias permanent put it in file ~/.bashrc (the file may not exist).
Restart bash with
source ~/.bashrc
The format is alias name='command'
Example:
alias list='ls -la'
To make alias permanent put it in file ~/.bashrc (the file may not exist).
Restart bash with
source ~/.bashrc
Run command./process or execute shell script using nohup
nohup allows to run command./process or shell script that have to continue running in the background after you log out from a shell.
nohup command-name &
nohup command-name &
- command-name : is name of shell script or command name. You can pass argument to command or a shell script.
- & : nohup does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an & symbol.
Tar/UnTar file and directory
#Tar file
tar -cvf file.tar myfile.txt
#Tar directory
tar -cvf home.tar directory/
#UnTar tar file
tar -xvf myfile.tar
#UnTar tar.gz file
tar -xvzf myfile.tar.gz
#UnTar tar directory
tar -xvf myfile.tar
#UnTar tar.gz directory
tar -xvzf myfile.tar.gz
tar -cvf file.tar myfile.txt
#Tar directory
tar -cvf home.tar directory/
#UnTar tar file
tar -xvf myfile.tar
#UnTar tar.gz file
tar -xvzf myfile.tar.gz
#UnTar tar directory
tar -xvf myfile.tar
#UnTar tar.gz directory
tar -xvzf myfile.tar.gz
Copy file scp
scp localFile user@host:/.../remoteFile
#Copy directory
scp -r localDir user@host:/remoteDir
Subscribe to:
Posts (Atom)
