Closed ghost closed 6 years ago
Feel free to send a Pull Request.
Thanks @crynobone , I don't have idea how can solve this .
I think after each migration (tenant) must to close the connection
I wander if I have more than 10000 databases , so I need to make the max connection to 100000 to make the migration works find?
There php artisan tenanti:queue migrate
large projects. Personally I'm using this on a single database connection therefore would really welcome contribution for multi-database setup.
Thanks @crynobone , I will try to fix this problem and I will share it with you if I found solution , and I hope any one can help us, I will be very thankful.
I make this steps:
I have 1500 databases and make max connection in mysql is 2000 connections
1- run (php artisan tenanti:queue tenant migrate ) .
2- run (php artisan queue:work) and now it will take first 538 tenants to migrate it. Then this error showing in bugsnage.
Illuminate\Database\QueryException · SQLSTATE[HY000]: General error: 1016 Can't open file:
'./dhmdb_579/tenant_579_migrations.frm' (errno: 24 - Too many open files) (SQL: select migration
from tenant_579_migrations
order by batch
asc, migration
asc)
when I go to mysql workbench or list proccess I found 583 connection still works and the migration is done.
so , just need to close connection after each migration
this is my migration file
Schema::create("test".$id, function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
Are you on 3.5
or 3.4
?
Laravel 5.4 Tenanti 3.4
hi , these are some screen shots
when I run php artisan tenanti:migrate ( more than 150+ connections are opened)
when I update max_connections mysql server to 2000 connections
I'm trying to close the connections after migrate each tenant but I cannot .
this package is working fine for one single database , because it need one connection and the connection will closed after finishing all migration files.
so I hope to make it close automatically after each migrate tenant
thanks @crynobone
Is this issue related to this?
Not related.
I upgraded my Laravel to 5.5 and package to 3.5 , and this is not solving the problem , I hope to update the package to fixed this issues
If you cannot work around with the package then you can look at increasing max_connections
in the my.cnf
on your server.
Reduce the number of max_connections
after migration.
Dont forget to restart mysql service, after every config change
It feels like it's not actually firing the disconnect for the selected db connection. And therefore I wonder if the issue is in the logic of checking for "default connection is not null" when needing to reset the "connection" (not the default)?
See: https://github.com/orchestral/tenanti/blob/3.5/src/Migrator/Migrator.php#L62-L63
therefore I wonder if the issue is in the logic of checking for "default connection is not null" when needing to reset the "connection" (not the default)?
The changes was made after this issue was created.
Okay. Curious why this issue is still open then. :)
@crynobone have you an example with eloquent into controllers(how get, store and update records) and models(how access to table with prefix records) in a project with single database ? , I don´t find documentation about this, thanks
We are using Laravel 5.4,Tenanti 3.4 We are getting the same issue. Please let us know is it possible to fix?
I'm trying to migrate to 1500+ database by this command php artisan tenanti:migrate
but all the connection still opened and make usage of ram very high
and the connections is more than 1500+ and still opened.
I want after each migration database the connection is closed