Today I used s3-parallel-put to send files to S3. The directory I was working with contained millions of small files. Using the standard s3cmd with the sync option never seemed to finish and without any error messages. With s3-parallel-put I can push files in parallel even controlling the number of processes.
The only tricky part here is the “guess” option. This basically tells AWS to guess the content type of the object you are uploading. AWS needs this information when it retrieves the object. Web browsers do most of the retrieving and they want headers! (which include content-types).
Also in the examples in the github project there is a “PREFIX”. I still have no idea what it is.
It should be an easy task to restart a mysql server. However, I recently ran into this:
[root@ip-172-31-44-221 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
There was nothing in /etc/init.d setup for mysql. After an hour of research I discovered this:
This is a simple way to upload a file CURL. The type i am doing is an “IPA” file which is an Apple iTunes binary. You need to change the contentType to your liking. This script is awesome for backups and other devops needs.
Ugh. I am out of space on an old mysql box. Moving to a new volume on AWS is pretty easy here are my notes. The only real catch here is TO REMEMBER to add it to fstab.
Creating a new volume
1) Create a new volume on ec2
2) Attach this new volume to the instance you want through their GUI. You can just click on a volume and click on attach to instance
3) ssh to the instance
4) fdisk /dev/xvdf
5) mkfs.ext3 /dev/xvdf
6) mount -t ext3 /dev/xvdf /disk
7) vi /etc/fstab
8) add /dev/xvdf /disk ext3 defaults,owner,errors=remount-ro 1 2
9) then fdisk -l to see your new hd, and df -H
Moving mysql to new position
1) rsync -vaC /var/lib/mysql/ /disk/mysql/
2) edit my.cnf and add:
innodb_data_home_dir = /disk/ibdata
log_bin = /disk/mysql-bin.log
3) mv /var/lib/mysql/ibdata /disk/ibdata/
4) service mysqld restart
5) then make sure mysql is running etc, and the slave is working
SNS from AWS now offers a great way to send mobile APNS messages to your users. Sure you can blow away money with urban airship. The great part is that AWS can keep track of endpoints that fail, does a queue system for you and AWS gives great error messages back when a APNS fails. Before we would have to read in a stream from apple’s push notification servers to see if the message failed and deal with all the bizarre time outs. The cost with AWS SNS is really cheap as well.
Setting up a SNS app
To setup an app simply open up your p12 file and copy paste the two sections of your p12 file into these boxes below on AWS. You can open your p12 file by using just an editor like VI.
Setting up SNS AWS
Create endpoints. Once you have an app setup with the correct p12 / pem file you can now create endpoints. An endpoint is a APNS token that can hold a value. We place the account_id into this value. In the image below you can see a User Data field. We add the account_id into that column.
First you want to get the AWS gem for ruby and install it. Once you have it installed you can try and setup an endpoint from the API. The code looks complicated but the only thing it is doing is getting an endpoint with the apns token passed from the mobile client.
Ran into this issue yesterday. I am using a webView to develop a prototype in HTML5. The problem is that my webView accesses an external file index.html. If you try and file the standard file:// protocol you will get strange security issues and the files wont load. The solution is below, basically we had to use myapp:// protocol which is defined by the iOS app.