Friday, June 27, 2014

Install phpMyAdmin 4.2.4 on CentOS,RHEL 6/5 and Fedora using Yum

phpMyAdmin is web-based client written in php for managing MySQL and MariaDB databases. It provides a user friendly web interface to access and manage your databases. To ease usage to a wide range of people, phpMyAdmin is being translated into 72 languages and supports both LTR and RTL languages.
phpmyadmin-banner

Features of phpMyAdmin:

    • Friendly web interface
    • Supported most of the MySQL features:
      • Browse and drop databases, tables, views, fields and indexes.
      • Create, copy, drop, rename and alter databases, tables, fields and indexes
      • Manage MySQL users and there privileges
    • Import data from CSV and SQL
    • Export data to various formats: CSV, SQL, XML, PDF, ISO/IEC 26300 – OpenDocument Text and Spreadsheet, Word, LATEX and others
    • Administering multiple servers
This article will help you to install phpMyAdmin on CentOS/RedHat System. It required Apache, PHP and MySQL to be installed on server. If you do not have them read our turtorials to how to install them.
Step 1: Enable Remi Repository
phpMyAdmin most updated package is available under remi repository. Install it in your system using following commands.
CentOS/RHEL 6:
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

CentOS/RHEL 5:
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm 

Fedora 20:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-20.rpm
 
Fedora 19:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-19.rpm
 
Fedora 18:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm

Step 2: Install phpMyAdmin
After adding remi repository, install phpMyAdmin using yum package manager. All the dependencies will automatically be installed.
# yum --enablerepo=remi install phpMyAdmin
Step 3: Configure phpMyAdmin
phpMyAdmin by default allowed to access from localhost only. If you want to make it accessible fromremote computers edit /etc/httpd/conf.d/phpMyAdmin.conf and update all 127.0.0.1 with your network like below or enable phpMyAdmin access for everyone.
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

## Comment below section to allow everyone 
<Directory /usr/share/phpMyAdmin/>
    <IfModule !mod_authz_core.c>
     Order Deny,Allow
     Deny from All
     Allow from 192.168.1.0/24
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
After updating phpMyAdmin apache configuration file, restart Apache service to reload new settings.
# service httpd restart
Step 4: Access phpMyAdmin in Browser
Now you can access phpMyAdmin in browser using following url. Change svr1.tecadmin.net with your server IP/FQDN.
http://svr1.tecadmin.net/phpMyAdmin/

Login Details: Use MySQL username and password.
phpMyAdmin-Login-Screen
Congratulation’s You have successfully installed phpMyAdmin. Using single phpMyAdmin we can manage multiple MySQL servers by adding multiple remote MySQL server. Use this article to add multiple MySQL hosts in phpMyAdmin.

How to Add Multiple Hosts in phpMyAdmin

This how to guide will help you to add multiple database hosts in phpMyAdmin, So we can select to which database server we need to connect.
After installing phpMyAdmin on your Linux/Windows systems, lets use this to manage multiple hosts from one phpMyAdmin install.
To add multiple hosts, first edit phpMyAdmin configuration file and add following entries at the end of file.
 # cd /usr/share/phpMyAdmin
 # vim config.inc.php
Now add the following entries at the end of file.
 $i++;
 $cfg['Servers'][$i]['verbose'] = 'Database Server 2';
 $cfg['Servers'][$i]['host'] = '192.168.1.102';
 $cfg['Servers'][$i]['port'] = '';
 $cfg['Servers'][$i]['socket'] = '';
 $cfg['Servers'][$i]['connect_type'] = 'tcp';
 $cfg['Servers'][$i]['extension'] = 'mysqli';
 $cfg['Servers'][$i]['auth_type'] = 'cookie';
 $cfg['Servers'][$i]['AllowNoPassword'] = false;
After adding the above entries in configuration file and access phpMyAdmin in web browser and you will get an option of server choice. Select server name to which you need to connect.
phpmyadmin-multiplehosts

Manage multiple MySql server using single phpmyadmin

As a System Administrator, we tend to manage a number of MYSQL Server instance. So we need to find a better way of managing this set of mysql server into much a easier and centralized way. In my environment, I have 5 different MySQL database servers running separately under different server location. Since it run standalone and not in cluster mode, I need to have one platform to manage these database servers altogether.
PHPmyAdmin is able to do this, with some changes on the configuration files. You just need to allow the MySQL user and host on every database server to be connected to. The setup that I am going to do will be as below:
phpmyadmin-multiple-mysql
Inorder to install phpmyadmin on ubuntu, you need 3 main packages apache , MySQL and php has to be installed and configured properly.
1. Apache2 installation and configuration
2. Mysql installation
3. PHP installation
I’m assuming you have already installed a running LAMP on your server.
After installing apache2, mysql and php, you can continue with the below steps to install and configure phpmyadmin

SET UP

The steps in this tutorial require the user to have root privileges on your VPS.
Variables being used in this tutorial are:
Web Server IP: 192.168.1.150
PHPmyAdmin directory: /etc/phpmyadmin
User: phpmaroot
Password: pmapass123!

Install phpmyadmin

We will going to install phpmyadmin on svr1.webserver, and this server will going to manage our MYSQL servers
  1. apt-get install phpmyadmin

Create root user to manage phpmyadmin

This step is optional, ofcourse we may use root to login on phpmyadmin.
  1. mysql&gt; CREATE USER 'phpmaroot'@'%' IDENTIFIED BY 'pmapass123!';
  2. mysql&gt; GRANT ALL PRIVILEGES ON *.* TO phpmaroot@'%';

Modify my.cnf of mysql servers

Make sure all database servers are listening to all IP which accessible from outside. To simplify this, just remove or comment if you find following lines in your my.cnf file (usually located under /etc) :
  1. #bind-address=127.0.0.1
  2. #bind-address=localhost

Make MySql accessible

To differentiate our MySQL servers easily, better we add the servers’ hostname into Web Server/PHPmyAdmin server /etc/hosts file. Based on my requirements above, I will add following line into the web server /etc/hosts:
  1. vi /etc/hosts
  1. root@i-svr:/etc/phpmyadmin# vi /etc/hosts
  2. 127.0.0.1 localhost
  3. 127.0.1.1 i-svr.dev i-svr
  4.  
  5. svr2.mysql 192.168.1.90
  6. svr3.mysql 192.168.1.91
  7. svr4.mysql 192.168.1.92
  8. svr5.mysql 192.168.1.93
  9. svr6.mysql 192.168.1.94

Modify phpmyadmin configuration file

We need to create PHPmyAdmin configuration files to include all databases server as above. Copy the configuration example as below to the active configuration file:
  1. cp /etc/phpmyadmin/config.inc.php /etc/phpmyadmin/config.inc.php.bak
always make a backup
Find and uncomment the line below:
  1. //$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
  2. $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Inside this file you will also see following line:
  1. /* Authentication type */
  2. //$cfg['Servers'][$i]['auth_type'] = 'cookie';
  3. /* Server parameters */
  4. //$cfg['Servers'][$i]['host'] = 'localhost';
  5. //$cfg['Servers'][$i]['connect_type'] = 'tcp';
  6. //$cfg['Servers'][$i]['compress'] = false;
  7. /* Select mysqli if your server has it */
  8. //$cfg['Servers'][$i]['extension'] = 'mysql';
Append the code below on top of the above lines:
  1. /* Authentication type */
  2. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  3. /* Server parameters */
  4. $cfg['Servers'][$i]['host'] = 'svr2.mysql';
  5. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  6. $cfg['Servers'][$i]['compress'] = false;
  7. /* Select mysqli if your server has it */
  8. $cfg['Servers'][$i]['extension'] = 'mysql';
  9. $cfg['Servers'][$i]['AllowNoPassword'] = false;
  10.  
  11. /*
  12. * Second server
  13. */
  14. $i++;
  15. /* Authentication type */
  16. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  17. /* Server parameters */
  18. $cfg['Servers'][$i]['host'] = 'svr3.mysql';
  19. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  20. $cfg['Servers'][$i]['compress'] = false;
  21. /* Select mysqli if your server has it */
  22. $cfg['Servers'][$i]['extension'] = 'mysql';
  23. $cfg['Servers'][$i]['AllowNoPassword'] = false;
  24.  
  25. /*
  26. * Third server
  27. */
  28. $i++;
  29. /* Authentication type */
  30. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  31. /* Server parameters */
  32. $cfg['Servers'][$i]['host'] = 'svr4.mysql';
  33. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  34. $cfg['Servers'][$i]['compress'] = false;
  35. /* Select mysqli if your server has it */
  36. $cfg['Servers'][$i]['extension'] = 'mysql';
  37. $cfg['Servers'][$i]['AllowNoPassword'] = false;
  38.  
  39. /*
  40. * Fourth server
  41. */
  42. $i++;
  43. /* Authentication type */
  44. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  45. /* Server parameters */
  46. $cfg['Servers'][$i]['host'] = 'svr5.mysql';
  47. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  48. $cfg['Servers'][$i]['compress'] = false;
  49. /* Select mysqli if your server has it */
  50. $cfg['Servers'][$i]['extension'] = 'mysql';
  51. $cfg['Servers'][$i]['AllowNoPassword'] = false;
  52.  
  53. /*
  54. * Fifth server
  55. */
  56. $i++;
  57. /* Authentication type */
  58. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  59. /* Server parameters */
  60. $cfg['Servers'][$i]['host'] = 'svr6.mysql';
  61. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  62. $cfg['Servers'][$i]['compress'] = false;
  63. /* Select mysqli if your server has it */
  64. $cfg['Servers'][$i]['extension'] = 'mysql';
  65. $cfg['Servers'][$i]['AllowNoPassword'] = false;
Now you should be able to open the PHPmyAdmin via web browser at http://192.168.1.150/phpmyadmin . You can select MySQL servers you want to connect and access it using phpmaroot user as created above.
phpmyadmin-multiple-mysql-actual

Wednesday, June 25, 2014

How I run VLC as root Ubuntu (100 % works for all linux

#sed -i 's/geteuid/getppid/g' `which vlc`

Sample script for cold backup on Linux with MySQL

#!/bin/bash
Days=`date +%Y%m%d-%H%M%S`;
Alfresco_root="/opt/alfresco";
Alfresco_repository="$Alfresco_root/alfresco_repository/";
Alfresco_indexes="$Alfresco_root/alfresco_indexes/";
Alfresco_backup_dir="/opt/Alfresco_Backup_$Days";
user_mysql="alfresco";
user_password="alfresco";
alfresco_db="alfresco";
echo "=== Stoping Alfresco ==="
echo $Alfresco_root/alfresco.sh stop
echo sleep 10;
echo "=== Making the directory backup $Alfresco_backup_dir ==="
echo mkdir $Alfresco_backup_dir;
echo cd $Alfresco_backup_dir;
echo "=== Make Mysql Backup ==="
echo mysqldump --user=$user_mysql --password=$user_password $alfresco_db -q --single-
transaction
-R
-t
--disable-keys
--complete-insert|
bzip2
>
$alfresco_db_$Days.sql.backup
echo "=== Creating Aflresco Repository Backup ==="
echo tar cjfv alfresco_repository_$Days.tar.bz2 $Alfresco_repository
echo "=== Creating Alfresco Indexes Backup ==="
echo tar cjfv alfresco_indexes_$Days.tar.bz2 $Alfresco_indexes
echo "=== Restating Alfresco ==="
echo $Alfresco_root/alfresco.sh start
 

    
Apart        from        the        examples        described        above,        there        is        full        featured        backup        tool        based        on      
Duplicity14        and        Linux        oriented        a        Backup        and        Recovery        tool        made        for        Alfresco        called        “Alfresco      
BART”15       (Alfresco       Backup       and       Recovery       Tool).       It       supports       a       variety       of       essentiadls       features       like

s3cmd Elaborated…

Use –rr option (reduced redundancy) for every put and sync commands !!!. 
Use –bucket-location option to mention nearest geographical location to avoid latency.
To view contents inside a bucket
#s3cmd ls s3://bucketname
To copy/sync a directory into a bucket
#s3cmd sync Desktop/check s3://bucket_name
To view all contents of all buckets one level down (only non empty buckets)
#s3cmd la -H
To sync contents of a local dir in a buckter under an existing directory (s3 object)
#s3cmd sync Desktop/checkunni/ s3://writingz/check/
To sync remote s3 contents to a local directory
#s3cmd sync s3://writingz/check/ Desktop/checkunni/
To sync contents of a local dir in a bucket under a new directory name
#s3cmd sync Desktop/checkunni/ s3://homie/newname/
Here newname directory is created on the fly and files of checkunni are copied inside s3://homie/newname
Copy a non-empty directory (on s3) from one bucket to another bucket
#s3cmd -r cp s3://homie/newname s3://writingz/
Copy a non-empty directory (on s3) from one bucket to another bucket under a new name
#s3cmd -r cp s3://homie/newname s3://writingz/newname2/
To find the size of a bucket/directory
#s3cmd du -H s3://writingz
To download only a single file
#s3cmd get s3://homie/dirname/filename .
To download a remote directory locally.
#s3cmd get -rf s3://writingz/checkunni .
use a / (forward slash) after checkunni to download only the files in it.
To upload a single file
#s3cmd put PSY.mp3 s3://homie/newname/
To upload a local dir to bucket
#s3cmd put -rf s3test s3://homie/newname/
Delete a file
#s3cmd del s3://writingz/abc.jpg
Delete a directory
#s3cmd del -rf s3://writingz/check/
Move a file (can also be used for rename with files only)
#s3cmd mv s3://writingz/abc.png s3://haye/
Move a directory to another bucket 
#s3cmd mv -rf s3://writingz/newname2 s3://haye/
Know the s3cmd version
#s3cmd –version
Make a file public using
#s3cmd put –acl-public hangover3.jpg s3://viewzz/abc.jpg
Make a file private using
#s3cmd setacl –acl-private s3://viewzz/hangover3.jpg
Set all files in a bucket to public/private
#s3cmd setacl –acl-public -r s3://writingz/
If an md5 checksum is need to verify files integrity use
#sudo s3cmd info s3://viewzz/hangover3.jpg (an amazon s3 object)
#md5sum hangover3.jpg (locally downloaded file from s3)
and compare the checksum value.
To delete a bucket (bucket has to be empty use s3cmd del – to delete all files)
#s3cmd rb s3://logix.cz-test (use -f option if bucket is non-empty)
Get various information about Buckets or Files
#s3cmd info s3://BUCKET[/OBJECT]
Other useful options
–delete-removed Delete remote objects with no corresponding local file
[sync]
–no-delete-removed Don’t delete remote objects.
–skip-existing Skip over files that exist at the destination (only
for [get] and [sync] commands).
–continue Continue getting a partially downloaded file (only for
[get] command).
–reduced-redundancy, –rr
Store object with ‘Reduced redundancy’. Lower per-GB
price. [put, cp, mv, sync]
–acl-public Store objects with ACL allowing read for anyone.
–acl-private Store objects with default ACL allowing access for you
only.
–bucket-location=BUCKET_LOCATION Datacentre to create bucket in. Eg :  ap-northeast-1  (Tokyo)
The ACL (Access Control List) of a file can be set at the time of upload using –acl-public or –acl-private options with ‘s3cmd put’ or s3cmd sync’ commands (see below).
Alternatively the ACL can be altered for existing remote files with ‘s3cmd setacl –acl-public’ (or –acl-private) command.
Additional Links on

Tuesday, June 24, 2014

How To Set Up MySQL Master-Master Replication

Intro

This second installment of "Scaling Web Applications" will list out the steps necessary for scaling a mysql deployment over two VPS.
The first article in this series laid out the steps needed to load-balance nginx over two VPS, and it is recommended that you read that article first.
MySQL replication is the process by which a single data set, stored in a MySQL database, will be live-copied to a second server. This configuration, called "master-slave" replication, is a typical setup. Our setup will be better than that, because master-master replication allows data to be copied from either server to the other one. This subtle but important difference allows us to perform mysql read or writes from either server. This configuration adds redundancy and increases efficiency when dealing with accessing the data.
The examples in this article will be based on two VPS, named Server C and Server D.
Server C: 3.3.3.3
Server D: 4.4.4.4

Step 1 - Install and Configure MySQL on Server C

The first thing we need to do is to install the mysql-server and mysql-client packages on our server. We can do that by typing the following:
sudo apt-get install mysql-server mysql-client
By default, the mysql process will only accept connections on localhost (127.0.0.1). To change this default behavior and change a few other settings necessary for replication to work properly, we need to edit /etc/mysql/my.cnf on Server C. There are four lines that we need to change, which are currently set to the following:
#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log
#binlog_do_db           = include_database_name
bind-address            = 127.0.0.1
The first of those lines is to uniquely identify our particular server, in our replication configuration. We need to uncomment that line, by removing the "#" before it. The second line indicates the file in which changes to any mysql database or table will be logged.
The third line indicates which databases we want to replicate between our servers. You can add as many databases to this line as you'd like. The article will use a single database named "example" for the purposes of simplicity. And the last line tells our server to accept connections from the internet (by not listening on 127.0.0.1).
server-id               = 1
log_bin                 = /var/log/mysql/mysql-bin.log
binlog_do_db            = example
# bind-address            = 127.0.0.1
Now we need to restart mysql:
sudo service mysql restart
We next need to change some command-line settings within our mysql instance. Back at our shell, we can get to our root mysql user by typing the following:
mysql -u root -p 
Please note that the password this command will prompt you for is that of the root mysql user, not the root user on our droplet. To confirm that you are logged in to the mysql shell, the prompt should look like the following.
mysql> 
Once we are logged in, we need to run a few commands.
We need to create a pseudo-user that will be used for replicating data between our two VPS. The examples in this article will assume that you name this user "replicator". Replace "password" with the password you wish to use for replication.
create user 'replicator'@'%' identified by 'password'; 
Next, we need to give this user permissions to replicate our mysql data:
grant replication slave on *.* to 'replicator'@'%'; 
Permissions for replication cannot, unfortunately, be given on a per-database basis. Our user will only replicate the database(s) that we instruct it to in our config file.
For the final step of the initial Server C configuration, we need to get some information about the current MySQL instance which we will later provide to Server D.
The following command will output a few pieces of important information, which we will need to make note of:
show master status; 
The output will looking similiar to the following, and will have two pieces of critical information:
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |      107 | example      |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
We need to make a note of the file and position which will be used in the next step.

Step 2 - Install and Configure MySQL on Server D

We need to repeat the same steps that we followed on Server C. First we need to install it, which we can do with the following command:
sudo apt-get install mysql-server mysql-client
Once the two packages are properly installed, we need to configure it in much the same way as we configured Server C. We will start by editing the /etc/mysql/my.cnf file.
sudo nano /etc/mysql/my.cnf 
We need to change the same four lines in the configuration file as we changed earlier.
The defaults are listed below, followed by the changes we need to make.
#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log
#binlog_do_db           = include_database_name
bind-address            = 127.0.0.1
We need to change these four lines to match the lines below. Please note, that unlike Server C, the server-id for Server D cannot be set to 1.
server-id              = 2
log_bin                = /var/log/mysql/mysql-bin.log
binlog_do_db           = example
# bind-address            = 127.0.0.1
After you save and quit that file, you need to restart mysql:
sudo service mysql restart
It is time to go into the mysql shell and set some more configuration options.
mysql -u root -p 
First, just as on Server C, we are going to create the pseudo-user which will be responsible for the replication. Replace "password" with the password you wish to use.
create user 'replicator'@'%' identified by 'password'; 
Next, we need to create the database that we are going to replicate across our VPS.
create database example; 
And we need to give our newly created 'replication' user permissions to replicate it.
grant replication slave on *.* to 'replicator'@'%'; 
The next step involves taking the information that we took a note of earlier and applying it to our mysql instance. This will allow replication to begin. The following should be typed at the mysql shell:
slave stop; 
CHANGE MASTER TO MASTER_HOST = '3.3.3.3', MASTER_USER = 'replicator', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 107; 
slave start; 
You need to replace 'password' with the password that you have chosen for replication. Your values for MASTER_LOG_FILE and MASTER_LOG_POS may differ than those above. You should copy the values that "SHOW MASTER STATUS" returns on Server C.
The last thing we have to do before we complete the mysql master-master replication is to make note of the master log file and position to use to replicate in the other direction (from Server D to Server C).
We can do that by typing the following:
SHOW MASTER STATUS; 
The output will look similiar to the following:
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000004 |      107 | example      |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
Take note of the file and position, as we will have to enter those on server C, to complete the two-way replication.
The next step will explain how to do that.

Step 3 - Completing Replication on Server C

Back on Server C, we need to finish configuring replication on the command line. Running this command will replicate all data from Server D.
 
slave stop; 
CHANGE MASTER TO MASTER_HOST = '4.4.4.4', MASTER_USER = 'replicator', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin.000004', MASTER_LOG_POS = 107; 
slave start; 
Keep in mind that your values may differ from those above. Please also replace the value of MASTER_PASSWORD with the password you created when setting up the replication user.
The output will look similiar to the following:
Query OK, 0 rows affected (0.01 sec)
The last thing to do is to test that replication is working on both VPS. The last step will explain an easy way to test this configuration.

Step 4 - Testing Master-Master Replication

Now that have all the configuration set up, we are going to test it now. To do this, we are going to create a table in our example database on Server C and check on Server D to see if it shows up. Then, we are going to delete it from Server D and make sure it's no longer showing up on Server C.
We now need to create the database that will be replicated between the servers. We can do that by typing the following at the mysql shell:
create database example; 
Once that's done, let's create a dummy table on Server C:
create table example.dummy (`id` varchar(10)); 
We now are going to check Server D to see if our table exists.
 
show tables in example; 
We should see output similiar to the following:
+-------------------+
| Tables_in_example |
+-------------------+
| dummy             |
+-------------------+
1 row in set (0.00 sec)
The last test to do is to delete our dummy table from Server D. It should also be deleted from Server C.
We can do this by entering the following on Server D:
DROP TABLE dummy; 
To confirm this, running the "show tables" command on Server C will show no tables:
Empty set (0.00 sec)
And there you have it! Working mysql master-master replication. As always, any feedback is more than welcome.

Alfresco Backup Script

Download complete script here

Monday, June 23, 2014

Moving from traditional filesystem storage to ATMOS for Alfresco

I recently had the opportunity to configure Alfresco with ATMOS using the Alfresco S3 connector.

The company I work for has an ATMOS cloud setup across multiple data centers.  

ATMOS is an object-based cloud storage platform to store, archive and access unstructured content at scale.  

We had an existing instance of Alfresco leveraging NetApp storage that I had to migrate to ATMOS.

In order to do this I needed to download and install 2 tools.


The steps to make the move to ATMOS are fairly simple…

    1.  Stop your Alfresco and Solr servers

    2.  Create your S3 bucket with ATMOS FOX. 
    3.  After you create the bucket you must add a non listable meta tag (bucket-mapping-type=one_to_one) to the bucket folder. 

     4.  Copy your files in your contentstore and contentstore.deleted to Atmos using AtmosSync.jar. 

     5.  Update your alfresco-global.properties with your S3 configuration.
          ### S3 Config ###
          s3.accessKey=xxxxxxxxxxxx/xxxx
          s3.secretKey=xxxxxxxxs3.bucketName=bucketNAME

             #s3.bucketLocation=US
             s3.flatRoot=falses3service.https-only=false
             s3service.s3-endpoint=ATMOSHOST
             s3service.s3-endpoint-http-port=8080#
             s3service.disable-dns-buckets=false
             dir.contentstore=contentstore
             dir.contentstore.deleted=contentstore.deleted
          #Maximum disk usage for the cache in MB 

             system.content.caching.maxUsageMB=51200
             #Maximum size of files which can be stored in the cache in MB (zero implies no limit)              
             system.content.caching.maxFileSizeMB=0 

      6.  Back up your DB if you haven’t already

      7.  Update all records in the ALF_CONTENT_URL table (store:// to s3://)
               UPDATE alf_content_url SET content_url = replace(content_url, 'store:', 's3:’)

 
     8.   Startup Alfresco and Solr servers and you should be good to go.   


Once you have verified that Alfresco is functioning properly you can repurpose the filesystem storage.

Alfresco - Configure various features

Audits

1. Open <ALFRESCO_HOME>/tomcat/shared/classes/alfresco-global.properties & add the following -
### Audits ###
audit.enabled=true
audit.alfresco-access.enabled=true
audit.alfresco-access.sub-actions.enabled=true
audit.filter.alfresco-access.default.enabled=true
audit.filter.alfresco-access.transaction.user=~null;.*
audit.filter.alfresco-access.transaction.type=cm:folder;cm:content;st:site
audit.filter.alfresco-access.transaction.path=~/sys:archivedItem;~/ver:;.*
2. Download audit-dashlet-0.43.jar
3. Copy audit-dashlet-0.43.jar into <ALFRESCO_HOME>/tomcat/shared/lib folder
4. Login as admin and add the audit dashlet on the dashboard.

Clustering

1. Make a copy of ehcache-custom.xml.sample.cluster as ehcache-custom.xml
cp <ALFRESCO_HOME>/tomcat/shared/classes/alfresco/extension/ehcache-custom.xml.sample.cluster <ALFRESCO_HOME>/tomcat/shared/classes/alfresco/extension/ehcache-custom.xml 
2.  Open <ALFRESCO_HOME>/tomcat/shared/classes/alfresco-global.properties & add the following -
### Clustering ###
index.recovery.mode=AUTO
dir.contentstore=${dir.root}/contentstore
dir.contentstore.deleted=${dir.root}/contentstore.deleted
dir.auditcontentstore=${dir.root}/audit.contentstore
alfresco.cluster.name=my-alfresco-cluster
alfresco.tcp.initial_hosts=<Machine1_IP>[7800],...
alfresco.jgroups.defaultProtocol=TCP
dir.indexes=${dir.root}/lucene-indexes
dir.indexes.backup=${dir.root}/backup-lucene-indexes
dir.indexes.lock=${dir.root}/locks
Please note that the attribute "alfresco.cluster.name" should have a value.

S3 Connector Integration

1. Download alfresco-s3-connector-1.0.0-5.amp
2. Copy the .amp file into "amps" folder
cp alfresco-s3-connector-1.0.0-5.amp <ALFRESCO_HOME>/amps
3. Run the apply_amps.sh script to install the .amp file
./apply_amps.sh
4. Check if the amp is installed properly
java -jar alfresco-mmt.jar list <ALFRESCO_HOME>/tomcat/webapps/alfresco.war
5. Open <ALFRESCO_HOME>/tomcat/shared/classes/alfresco-global.properties & add the following -
### S3 Integration ###
s3.accessKey=<S3_ACCESS_KEY>
s3.secretKey=<S3_SECRET_KEY>
s3.bucketName=<S3_BUCKET_NAME>

Replication via HTTPS / SSL

Refer Alfresco - Replication HOWTO on how to set up replication
1. Open <ALFRESCO_HOME>/tomcat/bin/catalina.sh and add the following -
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=<ALFRESCO_HOME>/alf_data/keystore/ssl.truststore -Djavax.net.ssl.trustStorePass=kT9X6oe68t -Djavax.net.ssl.trustStoreType=JCEKS"