ruby on rails - Running rake db:seed on AWS Elastic Beanstalk -
I am trying to appoint my first rail app using Elastic Beanstock, and I got it at that point Where I need seeds of my database with nearly five million records My initial attempt was to create a .config file in my .exe file and then use git aws.push from the command line, but it was giving me timeout errors.
So, I decided to abandon it and just straighten the SSH in its EC2 example and run it from there. However, this is not working either for me, I went to the CD in var / app / current, and then went to the Rake DB: Seed RAILS_ENV = The output starts running for a minute or two, then killed 'before leaving 'Are output.
I also tried to see that there was nothing in it with the size of a file, just a record seed. If I do this, then I get an error stating that my SQLite database is for reading only. I am pretty sure that my DB is set up to use MySQL in production, I have different ENV variables I have changed the database to use. And when I run Eb position from the command line, it tells me that MySQL is being used.
The strange thing is, I swear that I have taken these exact steps from the very beginning yesterday, sitting in the database and seeding, and have done this work. The only problem I made some changes, ended the app and decided to start, and now it does not work at all. Any thoughts that I am doing wrong? This is a Rail 4.1 / Ruby 2.1 setup.
So, I had to work this a while ago, I thought I should answer this. My first problem was that I databases. I left the adapter: mysql2 line, so it was trying to connect to a sqlite db, so readonly errors.
Once I changed it, I could have joined my AWS RDS example, and I have a record just fine, though, when I tried to straighten the entire 500k records, it is still I was also using the WSF Free Tier, so I think their micro instances do not allow long-lasting procedures for execution reasons. To go around it, I made a rake work that used to divide my seeds into a small file. RB file, for example Seed-01RB to Seed-1000RB
desc "divides one file into smaller subfiles" function: subfile, [: file name, num_files] => : Do the environment. Work, arguments | Line = file Roline (args [: filename]) num_files = args [: num_files] .to_i lines_per_file = lines.count / num_files extension = file.extname (args [: file name]) basename = File.basename (args [: filename]) Lines_per_file.to_s puts lines counts.to_s num_files.times do | Num_file | Subfile = File.open (basename + "- # {num_file}" + extension, "w") subline_start = num_file * lines_per_file subline_end = (num_file + 1) * lines_per_file-1 subline_end = lines.count-1 if num_file == num_files -1 sublines = lines [subline_start..subline_end] .each do | Subline | Then, I generated a Bash script to run each file, like:
Rail Runner seeds- 01. RB Rail Runner Seed-02 R.B. ... Railway Runner Seeds- 1000Rb It should be noted that I also looked at the following, and for whatever reason, it was using the rail runner Is much slower than in comparison.
Pseudo CP seeds- 01.rb seeds. Rb rake db: seeds ... pseudo capsule seeds-1000 Rb seeds Rb rake db: seed So do not do that, then after using elastic beanstock command line tools to deploy my app, I bowed in my installation and my bid script Run
cd / var / app / current / db bash bash- Script.txt This ensures that the files were too small that the timed out Gaya.
Nice article, keep updating new things AWS Online Course
ReplyDelete