Installation - abrenner/robinhood-multifs-web GitHub Wiki
Installing Robinhood MulitFS Interface
Requirements
- Robinhood 2.4.3 & 2.5
- NOTE The Hierarchy Model only works with 2.4.3 database schema of RBH. More Information The default stats model that RBH uses works with all versions.
- (If other versions work, please let me know!)
- MySQL 5+
- PHP 5.3+
Download from GitHub
Download the latest release from GitHub to the folder www-root (replace as needed)
git clone https://github.com/abrenner/robinhood-multifs-web.git www-root
Create MySQL User and Database
It is recommended to use the same user from Roinhood for Robinhood MulitFS. Regardless, the user will need SELECT (or higher) privilege for all Robinhood databases. It will need INSERT and UPDATE for its own internal database.
Create MySQL User and Grant User to RBH Databases
CREATE USER 'rbh'@'localhost' IDENTIFIED BY 'mypass';
Grant user rbh
to ALL databases that Robinhood uses. In this case we have two, rbh_gl
, rbh_fhgfs
.
GRANT ALL PRIVILEGES ON rbh_gl.* To 'rbh'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON rbh_fhgfs.* To 'rbh'@'localhost' IDENTIFIED BY 'mypass';
Repeat these commands as needed for each Robinhood database.
Create a new database for Robinhood MulitFS
Robinhood MulitFS requires its own database to keep internal stats for faster search results. Create the database rbh_stats
;
CREATE DATABASE rbh_stats;
GRANT ALL PRIVILEGES ON rbh_stats.* To 'rbh'@'localhost' IDENTIFIED BY 'mypass';
mysql -u rbh -p -D rbh_stats < database-dump.sql
The database-dump.sql file is from the git repo
Update Configuration file for Robinhood MulitFS
Update the configuration file: application/config/production/config.php
Change the value of $config['base_url']
to the fullpath of your site with a trailing slash.
Update Database Connection Pool
The database configuration file will need to have an entry for each robinhood database instance that you want monitored, plus one connection for the internal database that robinhood-mulitfs-web needs (the database-dump.sql
file we used earlier). As mentioned in the earlier section, the robinhood database user must have access to these databases. We need to provide that login information to the robinhood multifs web interface in order for it to pull stats.
Update the configuration file: application/config/production/database.php
Change the global username, password and database server connection details to match your own. This should be the same information as mentioned earlier in this document.
$globalUser = 'rbh';
$globalPass = 'mypass';
$globalhost = 'db-server-address'; // typically localhost
Database Connection for Robinhood-Mulitfs-Web internals
The following template is used to connect to the internal robinhood-multifs-web database. Change the value that ['database']
is set to something else. Otherwise, if the same information was used above, skip this section.
$db['default']['hostname'] = $globalhost;
$db['default']['username'] = $globalUser;
$db['default']['password'] = $globalPass;
$db['default']['database'] = 'rbh_stats'; // Change Me
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = FALSE;
$db['default']['stricton'] = FALSE;
Database Connection for each Robinhood Database to Monitor
For each robinhood database you want to have monitored, the following template must be created. The minimum amount is at least one Robinhood database and no upper limit has been defined (unlimited).
Each robinhood database must have a unique identifier as the first key if the db array. This is the ['gl']
section as mentioned below.
$db['gl']['hostname'] = $globalhost;
$db['gl']['username'] = $globalUser;
$db['gl']['password'] = $globalPass;
$db['gl']['database'] = 'rbh_gl'; // Change me
$db['gl']['dbdriver'] = 'mysql';
$db['gl']['dbprefix'] = '';
$db['gl']['pconnect'] = TRUE;
$db['gl']['db_debug'] = TRUE;
$db['gl']['cache_on'] = FALSE;
$db['gl']['cachedir'] = '';
$db['gl']['char_set'] = 'utf8';
$db['gl']['dbcollat'] = 'utf8_general_ci';
$db['gl']['swap_pre'] = '';
$db['gl']['autoinit'] = FALSE;
$db['gl']['stricton'] = FALSE;
Repeat this section, replacing the ['gl']
section with a unique identifier (string), and updating the the value that ['database']
points to, for each robinhood database.
(Last Step) Configure Database & Setup Cron
The final step is to insert records into the database so that robinhood-mulitfs-web can start importing data and sorting data to display on the website (mapping database information to robinhood databases)
This first version of robinhood-mulitfs-web requires the information to be stored in the database, which is a limitation of the framework (CodeIgniter) that I choose for this project. Future work is being done to move away from this framework to something more up-to-date.
For each robinhood database you want to monitor (as you specified in the database configuration file) the following record will need to be inserted. I suggest using phpMyAdmin which offers a web based GUI to MySQL database administration.
INSERT INTO `rbh_stats`.`config` (`fullpath`, `friendlyName`, `fsInodeNumber`, `dbGroup`, `label`, `description`) VALUES ('/path/on/disk', '/friendlyName', NULL, 'data', 'primary', 'Public Storage');
Replace the following values with that of your own that follows the VALUES(
section of the SQL query above. (or use phpMyAdmin or another MySQL GUI)
-
/path/on/disk
==> This is the start part (top level directory) of what you want monitored. (you can useNULL
if you want to ignore this option -- see FAQ section on more information) -
/friendlyName
==> This is the human friendly name that you can give to your filesystem. This is what is seen on all pages -
NULL
==> This is the fsInodeNumber as seen bystat
and is recorded in the robinhood database (you can useNULL
if you want to ignore this option -- see FAQ section on more information) -
data
==> This is the unique value that we specified in the database config file in this case: $db['data']....` -
primary
==> The color that is used for the label for the filesystem. See this page to understand what color goes with what label. -
Public Storage
==> Short label / phrase to describe the filesystem. (Use''
if you want to ignore this section).
Setup Cron
Setup a cronjob that will pull information from all the databases and aggregate the stats.
crontab -e
00 23 * * * lynx --dump http://my-website/index.php/cron/getStats 2>&1 /dev/null
runs at 11PM ever day. Replace my-website with the URL you specified in application/config/production/config.php
See see FAQ if you want to run the Hierarchy Model.