I am Codeigniter developer who was new to AWS OpsWorks. I have successfully created a database.php file with reference from AWS-getting started with db recipies.
Now i am facing a problem with ci_sessions table creation in database. Please refer to the below error log.
================================================================================
Error executing action `run` on resource 'execute[mysql-create-table]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) ----
STDOUT:
STDERR: sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 9: syntax error: unexpected end of file
---- End output of /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) ----
Ran /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) returned 1
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/phpapp/recipes/dbsetup.rb
2: execute "mysql-create-table" do
3: command "/usr/bin/mysql -u#{deploy[:database][:username]} -p#{deploy[:database][:password]} #{deploy[:database][:database]} -e'CREATE TABLE #{node[:phpapp][:dbtable]}(
4: session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
5: ip_address VARCHAR(63) NOT NULL,
6: user_agent VARCHAR(63) NOT NULL,
7: last_activity INT(10) UNSIGNED NOT NULL,
8: user_agent TEXT NOT NULL,
9: PRIMARY KEY (session_id),
10: KEY last_activity_idx (last_activity)
11: )"
12: not_if "/usr/bin/mysql -u#{deploy[:database][:username]} -p#{deploy[:database][:password]} #{deploy[:database][:database]} -e'SHOW TABLES' | grep #{node[:phpapp][:dbtable]}"
13: action :run
14: end
15: end
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/phpapp/recipes/dbsetup.rb:2:in `block in from_file'
execute("mysql-create-table") do
action [:run]
retries 0
retry_delay 2
command "/usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(\n session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,\n ip_address VARCHAR(63) NOT NULL,\n user_agent VARCHAR(63) NOT NULL,\n last_activity INT(10) UNSIGNED NOT NULL,\n user_agent TEXT NOT NULL,\n PRIMARY KEY (session_id),\n KEY last_activity_idx (last_activity)\n )"
backup 5
returns 0
cookbook_name "phpapp"
recipe_name "dbsetup"
not_if "/usr/bin/mysql -uroot -pbulkhouse vendor_data -e'SHOW TABLES' | grep ci_sessions"
end
[2015-08-29T13:57:47+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-08-29T13:57:47+00:00] INFO: template[mysql configuration] sending restart action to service[mysql] (delayed)
[2015-08-29T13:57:47+00:00] INFO: Processing service[mysql] action restart (mysql::server line 44)
[2015-08-29T13:57:51+00:00] INFO: service[mysql] restarted
[2015-08-29T13:57:51+00:00] ERROR: Running exception handlers
[2015-08-29T13:57:51+00:00] ERROR: Exception handlers complete
[2015-08-29T13:57:51+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2015-08-29T13:57:51+00:00] ERROR: execute[mysql-create-table] (phpapp::dbsetup line 2) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) ----
STDOUT:
STDERR: sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 9: syntax error: unexpected end of file
---- End output of /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) ----
Ran /usr/bin/mysql -uroot -pbulkhouse vendor_data -e'CREATE TABLE ci_sessions(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
) returned 1
[2015-08-29T13:57:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The Recipe which i had created was give below
node[:deploy].each do |app_name, deploy|
execute "mysql-create-table" do
command "/usr/bin/mysql -u#{deploy[:database][:username]} -p#{deploy[:database][:password]} #{deploy[:database][:database]} -e'CREATE TABLE #{node[:phpapp][:dbtable]}(
session_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(63) NOT NULL,
user_agent VARCHAR(63) NOT NULL,
last_activity INT(10) UNSIGNED NOT NULL,
user_agent TEXT NOT NULL,
PRIMARY KEY (session_id),
KEY last_activity_idx (last_activity)
)"
not_if "/usr/bin/mysql -u#{deploy[:database][:username]} -p#{deploy[:database][:password]} #{deploy[:database][:database]} -e'SHOW TABLES' | grep #{node[:phpapp][:dbtable]}"
action :run
end
end
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire