Skip to main content

Comments

16 comments

  • cPRex Jurassic Moderator
    Hey there! 1 - There are details about using an SSH key on this page: Create remote server transfer session as root user 2 - Details on setting up the transfer are here: Guide to Transfer and Restore API Functions - Queue the Transfer Item 3 - Disabling the transfer can be found here: Guide to Transfer and Restore API Functions - Plan the Transfer Session 4 - This would be the "force" flag from the same option in the link in #2 I will say, the Transfer APIs do require a lot of initial setup, and aren't always intuitive. You'll need to use each step from the attached image in order to successfully perform a transfer:
    0
  • Inna
    Thanks sir, yes, that's the way I found to transfer:) That took a lot time but finally figured out:( Thanks again for the help
    0
  • cPRex Jurassic Moderator
    I'm glad you were able to get things working!
    0
  • Inna
    Hello, This is my bash script: # create session and store in a variable session_id="$(/usr/sbin/whmapi1 --output=jsonpretty create_remote_root_transfer_session host='my.fqdn.com' user='root' port=2200 sshkey_name=id_ecdsa | awk '/"transfer_session_id" : / {print $3}' | sed -e 's|"||g' -e 's|,||g')" # send these parameters to queue /usr/sbin/whmapi1 enqueue_transfer_item \ module=AccountRemoteRoot \ user=myuser \ localuser=myuser \ force=1 \ replaceip='basic' \ skipaccount=1 \ overwrite_sameowner_dbs=1 \ overwrite_sameowner_dbusers=1 \ transfer_session_id="$session_id" # start transfer /usr/sbin/whmapi1 start_transfer_session transfer_session_id="$session_id"
    But after I run it to restore, I have the following warnings which creates new databases: The system has restored the MySQL database "myuser_db" as "myuser_db2".
    If I run again (in fact I tested it several times), I see this: The system has restored the MySQL database "myuser_db" as "myuser_db3".
    Can you please help me how to overwrite the database?
    0
  • cPRex Jurassic Moderator
    Just to confirm, both the "user" and "localuser" have the same value in the script, correct?
    0
  • Inna
    Just to confirm, both the "user" and "localuser" have the same value in the script, correct?

    Yes, both have the same value.
    0
  • cPRex Jurassic Moderator
    Thanks for confirming that. Can you also confirm that you are not using the restricted mode options? There is also an "overwrite_all_dbusers" flag as well that could be worth trying. From what I am seeing, you are doing everything correctly with your code.
    0
  • Inna
    Thanks, I see in the docs. Is the value an integer? I mean should I use like this? overwrite_all_dbusers=1
    0
  • Inna
    With using "unrestricted_restore=1", I got an error that I cannot use it with "AccountRemoteRoot" module. Without this line, the transfer has started and I'm waiting for it to complete.
    0
  • cPanelThomas
    RE overwrite_all_dbusers not showing up as an argument in the other API docs, that's somewhat of an oversight in my opinion. Basically, the schema modules there define the arguments you can pass into enqueue_transfer_item which correspond to the given module. Not really sure how to best relay that in docs however.
    0
  • Inna
    These are the logs of my last transfer (last night in fact): [quote] MysqlRemoteNotes MysqlRemoteNotes Mysql Preparing MySQL restore " Databases owned by "myuser" will be overwritten on conflict. The system will restore the database "myuser_db" as "myuser_db4" because another cPanel user owns "myuser_db". Restoring MySQL databases Restoring the database "myuser_db" as "myuser_db4" " The system has created a new database named "myuser_db4". Granting "myuser" access to "myuser_db4" with temporary password " Spawning restoration subprocess for "myuser_db4" " The remote MySQL dump ended successfully. Transfer complete. Awaiting subprocess completion " Connecting to SQL server (/var/lib/mysql/mysql.sock) as "myuser" in order to restore "myuser_db4" " Disabling InnoDB strict mode for database restore for "myuser_db4" " Restoring database data for "myuser_db4" " Processing SQL statements " The database restoration subprocess for "myuser_db4" has ended. The system has restored the contents of the database "myuser_db4". Restoring MySQL database mappings Restoring MySQL privileges Database users owned by "myuser" will be overwritten on conflict. Restoring MySQL grants Restoring MySQL access hosts Storing MySQL Grants Mysql
    Just to make it clear: In the server account is restored, I first created a new account called "myuser". Then I ran my script to live transfer from the source. Is that correct what I did? I suspect this may raise the issue.
    0
  • Inna
    I ran with "overwrite_all_dbusers" option but I still see it creates a new database: [quote] RESTORE: Account "myuser": Warnings The system has restored the MySQL database "myuser_db" as "myuser_db3". Rename
    0
  • cPRex Jurassic Moderator
    I'm doing a bit of testing with this today and I'll send you an update as soon as I have one!
    0
  • cPRex Jurassic Moderator
    I wasn't able to reproduce this on the test machines I built, as the database and the user were properly overwritten when using your script. Could you submit a ticket to our team so we could do some additional testing with your environment?
    0
  • Inna
    Thanks. I'm trying to obtain trial license but I'm not sure why I cannot. I reset my password in but I cannot logon with the new password in account.cpanel.net. Can I send you the IPs in your private message to activate the trial?
    0
  • cPRex Jurassic Moderator
    I'm not able to do that on my end. You'll want to email cs@cpanel.net and they can check out your account and get that trial license issued.
    0

Please sign in to leave a comment.