Switching StorageModule to ArticleStorageFS

Moderator: crythias

Locked
jforrow
Znuny newbie
Posts: 26
Joined: 02 Sep 2010, 16:21
Znuny Version: 3.0.9

Switching StorageModule to ArticleStorageFS

Post by jforrow »

Hi,

Been running OTRS 2.4.x for about a year now and the MySQL database is huge.

I'd like to switch to the File System storage for future attachments, but does anyone know how to etract exising attachments from the DB to FS storage? This would really help me reduce the size of my database.

Thanks

Jon
Test : OTRS 3.1.12 with ITSM 3.1.7
Prod : OTRS 3.1.12 with ITSM 3.1.7
Both running on Centos 5.7 with Mysql Database
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: Switching StorageModule to ArticleStorageFS

Post by Wolfgangf »

Jon,
have a look at /opt/otrs/bin/otrs.ArticleStorageSwitch.pl
BR
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
Mike_B
Moderator
Posts: 266
Joined: 12 Jan 2010, 18:16
Znuny Version: CVS HEAD

Re: Switching StorageModule to ArticleStorageFS

Post by Mike_B »

jforrow wrote:Hi,

Been running OTRS 2.4.x for about a year now and the MySQL database is huge.

I'd like to switch to the File System storage for future attachments, but does anyone know how to etract exising attachments from the DB to FS storage? This would really help me reduce the size of my database.

Thanks

Jon
It's in the 3.0.x manual (but even so applicable for 2.4.x):
http://doc.otrs.org/3.0/en/html/c3207.h ... rs-storage
huntingbears.nl - @michielbeijen on Twitter
jforrow
Znuny newbie
Posts: 26
Joined: 02 Sep 2010, 16:21
Znuny Version: 3.0.9

Re: Switching StorageModule to ArticleStorageFS

Post by jforrow »

Mike_B wrote:
It's in the 3.0.x manual (but even so applicable for 2.4.x):
http://doc.otrs.org/3.0/en/html/c3207.h ... rs-storage
Thanks, I switched over to FS Article Storage thorugh the SYSconfig interface last night.

When I ran:

bin/otrs.ArticleStorageSwitch.pl -s ArticleStorageDB -d ArticleStorageFS

I got this error message before I stopped the script:

[Error][Kernel::System::Ticket::Article::ArticleAttachmentIndex][Line:3147]: Need UserID!
Nov 23 17:34:24 PPS-VM-OTRS last message repeated 1042 times

The httpd service is running as the otrs user, and I've confirmed that user can write to the filestore location "/var/otrs_filestore".

The script has started creating the directory structure in that location, so it's partly working.

Any ideas?

Thanks
Test : OTRS 3.1.12 with ITSM 3.1.7
Prod : OTRS 3.1.12 with ITSM 3.1.7
Both running on Centos 5.7 with Mysql Database
jforrow
Znuny newbie
Posts: 26
Joined: 02 Sep 2010, 16:21
Znuny Version: 3.0.9

Re: Switching StorageModule to ArticleStorageFS

Post by jforrow »

This was reported as a bug today and a fix is available for download:

Bugzilla entry: http://bugs.otrs.org/show_bug.cgi?id=6382

File download: http://source.otrs.org/viewvc.cgi/otrs/ ... iew=markup
jforrow wrote:
Mike_B wrote:
It's in the 3.0.x manual (but even so applicable for 2.4.x):
http://doc.otrs.org/3.0/en/html/c3207.h ... rs-storage
Thanks, I switched over to FS Article Storage thorugh the SYSconfig interface last night.

When I ran:

bin/otrs.ArticleStorageSwitch.pl -s ArticleStorageDB -d ArticleStorageFS

I got this error message before I stopped the script:

[Error][Kernel::System::Ticket::Article::ArticleAttachmentIndex][Line:3147]: Need UserID!
Nov 23 17:34:24 PPS-VM-OTRS last message repeated 1042 times

The httpd service is running as the otrs user, and I've confirmed that user can write to the filestore location "/var/otrs_filestore".

The script has started creating the directory structure in that location, so it's partly working.

Any ideas?

Thanks
I think I've solved this issue myself:

During testing I also found that I couldn't attach any files to tickets; I got a Permission denied error on CGITempFile.

I fixed this error by editing

Code: Select all

opt/otrs/Kernel/cpan-lib/CGI.pm
: I uncommented and edited this line: (Line 26 I think)

Code: Select all

$CGITempFile::TMPDIRECTORY = '/var/otrstmp/';
So now I could upload files to OTRS, but the conversion script (./otrs.ArticleStorageSwitch.pl -s ArticleStorageDB -d ArticleStorageFS) still gave these errors:

Code: Select all

ERROR: OTRS-otrs.ArticleStorageSwitch.pl-10 Perl: 5.8.8 OS: linux Time: Wed Nov 24 14:57:54 2010

 Message: Need UserID!

 Traceback (29755):
   Module: Kernel::System::Ticket::Article::ArticleAttachmentIndex (v1.260) Line: 3147
   Module: bin/otrs.ArticleStorageSwitch.pl (v1.10) Line: 105

ERROR: OTRS-otrs.ArticleStorageSwitch.pl-10 Perl: 5.8.8 OS: linux Time: Wed Nov 24 14:57:54 2010

 Message: Need UserID!

 Traceback (29755):
   Module: Kernel::System::Ticket::Article::ArticleAttachmentIndex (v1.260) Line: 3147
   Module: bin/otrs.ArticleStorageSwitch.pl (v1.10) Line: 172
I checked line 105:

Code: Select all

 # read source attachments
        my %Index = $TicketObjectSource->ArticleAttachmentIndex(
            ArticleID     => $ArticleID,
            OnlyMyBackend => 1,
       );
I saw it was missing the UserID variable. So it hacked it in:

Code: Select all

 # read source attachments
        my %Index = $TicketObjectSource->ArticleAttachmentIndex(
            ArticleID     => $ArticleID,
            OnlyMyBackend => 1,
            UserID   => 1,
        );
I did the same to line 172:

Code: Select all

 # verify destination attachments
        %Index = $TicketObjectDestination->ArticleAttachmentIndex(
            ArticleID     => $ArticleID,
            OnlyMyBackend => 1,
        );
Changed it to:

Code: Select all

 # verify destination attachments
        %Index = $TicketObjectDestination->ArticleAttachmentIndex(
            ArticleID     => $ArticleID,
            OnlyMyBackend => 1,
            UserID   => 1,
        );
The script is re-running now and seems to be working correctly.
Test : OTRS 3.1.12 with ITSM 3.1.7
Prod : OTRS 3.1.12 with ITSM 3.1.7
Both running on Centos 5.7 with Mysql Database
Locked