This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ======================== Elasticsearch Configuration ========================= | |
# | |
# NOTE: Elasticsearch comes with reasonable defaults for most settings. | |
# Before you set out to tweak and tune the configuration, make sure you | |
# understand what are you trying to accomplish and the consequences. | |
# | |
# The primary way of configuring a node is via this file. This template lists | |
# the most important settings you may want to configure for a production cluster. | |
# | |
# Please consult the documentation for further information on configuration options: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth_enabled: false | |
server: | |
http_listen_port: 3100 | |
grpc_listen_port: 9096 | |
common: | |
path_prefix: /etc/loki | |
storage: | |
filesystem: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server: | |
http_listen_port: 9080 | |
grpc_listen_port: 0 | |
positions: | |
filename: /etc/promtail/positions.yaml | |
clients: | |
- url: http://localhost:3100/loki/api/v1/push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.audit_ddl() | |
RETURNS event_trigger | |
LANGUAGE plpgsql | |
AS $function$ | |
declare _qry text; | |
BEGIN | |
if (tg_tag='CREATE TABLE' or tg_tag='ALTER TABLE' or tg_tag='DROP TABLE') then | |
SELECT current_query() into _qry; | |
insert into public.ddl_audit | |
values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup Auto Scaling along with scale up and down policy | |
1. Build AMI | |
we need to first build AMI by installing Amazon monitoring scripts to monitor memory utilization and send to cloudwathc and also install other required dependencies to run application. | |
2. Create launch configuration | |
we create launch configuration with options like availability zone, security groups, vpc, etc. | |
3. Create autoscaling group and autoscaling policy | |
This points at our earlier launch configuration and it lauch instances based on launch configuration. The tag,vpc security groups is propogated to any launched instance at launch. Also we define min and max number of instances. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup MongoDB Replica with Password Authentication in Ubuntu 20.04 LTS. | |
(1 Master and 2 Secondary) | |
Overview | |
1. Install MongoDB to all servers. | |
2. Run rs.status() to check Replica set status. | |
3. Generate Key file on any one server. | |
4. Copy keyfile to all servers. | |
5. Update conf file for keyfile, replicaset name and bind address on all servers. | |
6. Restart MongoDB on servers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sshd] | |
enabled = true | |
#call iptables to ban IP address | |
banaction = iptables-multiport | |
#ban on all ports | |
banaction_allports = iptables-allports | |
bantime = 31536000 #this is one year ban time | |
#bantime = -1 this will ban permanently |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#web socket | |
listener 9001 | |
protocol websockets | |
pid_file /var/run/mosquitto.pid | |
user ubuntu | |
persistence true | |
persistence_location /var/lib/mosquitto/ | |
max_connections -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream websocket { | |
server localhost:9001; | |
} | |
server { | |
server_name mqtt.sujitpatel.in; #change accordingly | |
location / { | |
proxy_pass http://websocket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST="some-database.rds.amazonaws.com" | |
USER="admin" | |
PASSWORD_FILE="/root/.rds.cnf" | |
OUTPUT="/data/schema" | |
databases=`mysql --defaults-extra-file=$PASSWORD_FILE -u $USER -h $HOST -NBe "select group_concat(schema_name separator ' ') from information_schema.schemata where schema_name not in ('sys','mysql', 'information_schema', 'performance_schema')"` | |
# GET Total number of databases. |
OlderNewer