5

I'm trying to synchronize a production database to two development installations at once, instead of having the production database dumped twice.

In aliases.drush.inc file I'm defining a site-list alias as following:

$aliases['dev'] = array(
  'site-list' => array('@dev1', '@dev2'),
);

$aliases['prod'] = array(
  'uri' => 'default/prod',
  'root' => '/docroot/prod',
  'db-url' => 'mysqli://root:pass@localhost/prod',
);  
$aliases['dev1'] = array(
  'uri' => 'default/dev1',
  'root' => '/docroot/dev1',
  'db-url' => 'mysqli://root:pass@localhost/dev1',
);
$aliases['dev2'] = array(
  'uri' => 'default/dev2',
  'root' => '/docroot/dev2',
  'db-url' => 'mysqli://root:pass@localhost/dev2',
);  

Running a Drush command against any of these aliases works fine.

Running drush @dev status works fine too, and displays the status for both @dev1 and @dev2.

However, trying to execute drush sql-sync @prod @dev gives me the following error:

Error: no alias record could be found for @dev

Do you have any clues?

3
  • What happens when you run drush sql-sync @prod @dev1? What happens when you run drush sql-sync @prod @dev.dev1?
    – LLub
    Commented Nov 7, 2011 at 10:51
  • 1
    Unfortunately, this feature is buggy in Drush and will be removed. Check this out: drupal.org/node/1316378
    – Remon
    Commented Nov 7, 2011 at 11:30
  • @Remon You should place that as the answer and close this out then. Looks like you have the correct answer.
    – chrisjlee
    Commented Dec 1, 2011 at 17:18

3 Answers 3

2

Seems that this feature is buggy in Drush and will be removed. Check this out: drupal.org/node/1316378

1

Drush 8+ expects a site alias file. For me it turned out that the drush/sites/self.site.yml didn't exist after I've run into a similar error. The alias file didn't got copied properly into a container.

You need to ensure that the alias file exists.

$ drush sql-sync @test @self -y
Error: no alias record could be found for source [error]
@test

Here's a nice article about Drush Site Aliases for Drupal 8 and Drupal 9 and how this actually is supposed to work in detail: https://drupalize.me/tutorial/drush-site-aliases?p=2458

0

copy the DB array from your settings to your aliases file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.