View amazon_time_sync_service.sh
sudo yum erase ntp* -y
sudo yum install chrony -y
sudo service chronyd start
sudo chkconfig chronyd on
chronyc sources -v
View dnsmasq.sh
## Using Dnsmasq for local development on OS X ##
## DNS & DHCP ##
# Installation
# Update your homebrew installation
brew up
# Install dnsmasq
brew install dnsmasq
# Configuration
View boto3
Problem:
```
sudo pip install boto3
The directory '/Users/tankhuu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/tankhuu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting boto3
Downloading boto3-1.4.7-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 837kB/s
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3)
Downloading s3transfer-0.1.11-py2.py3-none-any.whl (54kB)
View create-s3-snapshot-repository.json
PUT _snapshot/s3_repo
{
"type": "s3",
"settings": {
"bucket": "bucket_name",
"base_path": "elasticsearch/snapshots"
}
}
GET /_snapshot/s3_repo
View add-swap.sh
# VARIABLES #
swapSize=4G
# EXECUTE #
# Check swap
sudo swapon -s
# Create swapfile
sudo fallocate -l $swapSize /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
View setup-aws-scripts-mon.sh
#!/usr/bin/env bash
cat << EOF > ~/setup-aws-scripts-mon.sh
#!/usr/bin/env bash
# VARIABLES #
AWSAccessKeyId=\$1
AWSSecretKey=\$2
CRON_DIR=/var/spool/cron/crontabs
# EXECUTE #
View elasticsearch-define-templates.json
# DELETE _template/mysql_slow
PUT _template/mysql_slow
{
"order": 0,
"template": "mysql-slow-*",
"settings": {
"index": {
"number_of_shards": "1"
}
},
View amazon_linux_install_logstash.sh
#!/usr/bin/env bash
java_base_version="8"
java_sub_version="161"
java_base_build="12"
java_version="${java_base_version}u${java_sub_version}"
java_build="b${java_base_build}"
java_version_with_build="${java_version}-${java_build}"
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/${java_version_with_build}/2f38c3b165be4555a1fa6e98c45e0808/jdk-${java_version}-linux-x64.rpm"
View IssuesAndSolutions.txt
# Issue 1 - lua script variable convention
2017/09/16 03:37:40 [error] 28233#28233: *3524 failed to load external Lua file "/usr/local/openresty/nginx/conf/elasticsearch/authorize.lua": /usr/local/openresty/nginx/conf/elasticsearch/authorize.lua:78: '}' expected (to close '{' at line 54) near 'tankhuu', client: 123.21.100.186, server: , request: "GET / HTTP/1.1", host: "secure.elasticsearch.com"
--> Solution:
In lua script, if a variable contain the special characters such as tankhuu@gmail.com, we have to cover it with ["tankhuu@gmail.com"]
# Issue 2 - missing library
2017/09/16 04:34:32 [error] 28996#28996: *6 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/elasticsearch/access.lua:5: module 'resty.http' not found:
no field package.preload['resty.http']
no file '/usr/local/openresty/site/lualib/resty/http.ljbc'
no file '/usr/local/openresty/site/lualib/resty/http/init.ljbc'