Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:migration_from_a_mysql_to_a_postgresql_database [2015/09/23 16:59] – [New procedure] neyronwiki:migration_from_a_mysql_to_a_postgresql_database [2015/09/23 17:11] (current) – [New procedure] neyron
Line 7: Line 7:
 See: https://github.com/oar-team/python-oar-cli See: https://github.com/oar-team/python-oar-cli
  
-Once the postgresql database engine is setup, oar database created with the oar user (using the oar-database tool), one can use the oar-database-migrate tools, as follows:+Installation of oar-cli which provides oar-database-migrate:
  
 <code bash> <code bash>
Line 16: Line 16:
 </code> </code>
  
 +Create the new OAR database (postgresql) + oar database users, and empty the base.
 <code> <code>
-oar-database-migrate --current-db-url mysql://oarreader:PASSWORD@.../oar --new-db-url postgresql://oar:PASSWORD@/...+$ sudo oar-database --create --db-is-localuser                                                                               
 +$ sudo su postgres                                                                                                                             
 +$ dropdb oar       
 +$createdb oar -oar                                                                                                                          
 +$ exit
 </code> </code>
  
 +Run the migration
 +<code>
 +oar-database-migrate --current-db-url mysql://oar_ro:PASSWORD@mysql_server/oar --new-db-url postgresql://oar:PASSWORD@/pgsql_server
 +</code>
 +
 +Fix the rights of the oar database users (oar and oar_ro in this example):
 +<code>
 +$ psql oar2
 +  GRANT ALL PRIVILEGES ON schema,accounting,admission_rules,assigned_resources,
 +  challenges,event_log_hostnames,event_logs,files,frag_jobs,gantt_jobs_predictions,
 +  gantt_jobs_predictions_visu,gantt_jobs_resources,gantt_jobs_resources_visu,
 +  job_dependencies,job_resource_descriptions,job_resource_groups,
 +  job_state_logs,job_types,jobs,moldable_job_descriptions,queues,
 +  resource_logs,resources,admission_rules_id_seq,event_logs_event_id_seq,
 +  files_file_id_seq,job_resource_groups_res_group_id_seq,
 +  job_state_logs_job_state_log_id_seq,job_types_job_type_id_seq,
 +  moldable_job_descriptions_moldable_id_seq,resource_logs_resource_log_id_seq,
 +  resources_resource_id_seq,jobs_job_id_seq TO oar;
 +
 + GRANT SELECT ON schema,accounting,admission_rules,assigned_resources,event_log_hostnames,
 +  event_logs,files,frag_jobs,gantt_jobs_predictions,gantt_jobs_predictions_visu,
 +  gantt_jobs_resources,gantt_jobs_resources_visu,job_dependencies,
 +  job_resource_descriptions,job_resource_groups,job_state_logs,job_types,
 +  jobs,moldable_job_descriptions,queues,resource_logs,resources,admission_rules_id_seq,
 +  event_logs_event_id_seq,files_file_id_seq,job_resource_groups_res_group_id_seq,
 +  job_state_logs_job_state_log_id_seq,job_types_job_type_id_seq,
 +  moldable_job_descriptions_moldable_id_seq,resource_logs_resource_log_id_seq,
 +  resources_resource_id_seq,jobs_job_id_seq TO oar_ro;
 +</code>
 +
 +This procedure is based on Grid'5000 documentation: https://www.grid5000.fr/mediawiki/index.php/Migration_Postgres_OAR (access is restricted to Grid'5000 users)
 ==== Old Procedure ==== ==== Old Procedure ====
 The procedure proposed here follows these steps: The procedure proposed here follows these steps:
wiki/migration_from_a_mysql_to_a_postgresql_database.txt · Last modified: 2015/09/23 17:11 by neyron
Recent changes RSS feed GNU Free Documentation License 1.3 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki