Pages

Subscribe:

Friday, May 22, 2020

[Solved] OutofMemory Exception on Java Application running on Docker Containers

We recently came across a issue where the java application was frequently facing the OutofMemory Exception.

Usually the Java based applications use the parameters -XX:MaxRAMPercentage / -XX:MinRAMPercentage are used to restrict the heap utilization within certain % limits from 1 to 100 which holds good when you running these applications on the virtual instances like EC2.

But when you running them on containers than VM allocates a larger fraction of memory to the Java Heap. To turn off this behaviour, set the -XX:-UseContainerSupport

When -XX:MaxRAMPercentage / -XX:InitialRAMPercentage are used with -XX:+UseContainerSupport, the corresponding heap setting is determined based on the memory limit of the container.

Saturday, May 16, 2020

Installing Terraform on Centos Linux

1. Download the terraform for the linux from the site using wget
https://www.terraform.io/downloads.html
wget https://releases.hashicorp.com/terraform/0.12.25/terraform_0.12.25_linux_amd64.zip

2.Install the unzip if not already installed as
yum install unzip

3. Unzip the zip file to the /usr/local/bin as 
unzip terraform_0.12.25_linux_amd64.zip -d /usr/local/bin/

4. Verify the terraform has been successfully installed as
[[email protected] ~]# terraform -v
Terraform v0.12.25

Wednesday, March 4, 2020

Using Netcat to check connectivity to mysql on port 3306

Netcat is a tool in linux which can be very powerful is used correctly.

If you want to check the default port is pingable for mysql i.e. 3306 you can validate it via netcat


[ankit.mittal@bastion.test2]# nc -vz master-db.unixcloudfusion.in 3306
Connection to master-db.unixcloudfusion.in 3306 port [tcp/mysql] succeeded!

Tuesday, March 3, 2020

[Solved] Message: Field 'id' doesn't have a default value

Error:-
Message: Field 'id' doesn't have a default value

Cause:-
The field ID error occurred when i was inserting the ID column as the primary key

ADD COLUMN id INT(10) NOT NULL FIRST, ADD PRIMARY KEY (id)


The error signifies for the default value to be assigned since it would be unique everytime.


Solution:-
Adding the AUTO_INCREMENT in the query resolved the issue

ADD COLUMN id INT(10) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (id)

[Solved] ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Error:-

ERROR 1227 (42000) at line 18: Access denied; you need (at least 
one of) the SUPER privilege(s) for this operation

Scenario:- I have taken a backup of the Mysql table using mysqldump and tried to restore the same in the Amazon AWS RDS

Cause:- The error occurs when database has the binary log enabled, and mysqldump file contains an object(trigger, view, function or event)

Now if any of the create statements dont include "NO SQL", "READS SQL DATA" or "DETERMINISTIC" keywords, than mysql cant write that object and import fails

Solution:-
Change the parameter group value

log_bin_trust_function_creators = 1
global_log_bin_trust_function_creators = 1 (More relaxed permission for 
                                            allowing import of all objects)

Thursday, February 27, 2020

[Solved] com/okta/tools/WithOkta : Unsupported major.minor version

Error

 Exception in thread "main" java.lang.UnsupportedClassVersionError: com/okta/tools/WithOkta : Unsupported major.minor version 52.0  
      at java.lang.ClassLoader.defineClass1(Native Method)  
      at java.lang.ClassLoader.defineClass(ClassLoader.java:808)  
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)  
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)  
      at java.net.URLClassLoader.access$100(URLClassLoader.java:64)  
      at java.net.URLClassLoader$1.run(URLClassLoader.java:354)  
      at java.net.URLClassLoader$1.run(URLClassLoader.java:348)  
      at java.security.AccessController.doPrivileged(Native Method)  
      at java.net.URLClassLoader.findClass(URLClassLoader.java:347)  
      at java.lang.ClassLoader.loadClass(ClassLoader.java:430)  
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:323)  
      at java.lang.ClassLoader.loadClass(ClassLoader.java:363)  
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)  

Cause/solution:-

Main reason for this error is older version of the Java JDK being used. Like in mine case it was

 java -version  
 java version "1.7.0_191"  
 OpenJDK Runtime Environment (amzn-2.6.15.4.82.amzn1-x86_64 u191-b01)  
 OpenJDK 64-Bit Server VM (build 24.191-b01, mixed mode)  

But the application requires atleast JDK Version 1.8 .

So to resolve the issue consider upgrading the JDK to version 1.8 instead.

Wednesday, February 26, 2020

Learnings Shared in Kubernetes Conference in Delhi 2020

1. Kubernetes implementation on cloud and on-premise are very different.

2. Enough linux internals for a solid understanding of how to operate kubernetes in production environment.

3. Install and operate kubernetes using only community tools.

4. Deploy community kubernetes cluster on manually VMs from scratch.

5. Design and implement CI/CD piepelines for independent deployments.

6. Figure out governance strategies to independently develop, configure and operate each microservice in a kubernetes cluster.

7. Configure istio  in a flexible manner to govern east-west traffic.

8. Run all K8s processes as Docker containers rather than binaries.

9. In the absence of open internet, start with docker registry first and populate all necessary images.

10. Use kubespray to setup RHEL VMs
--> Use Ansible playbooks for opinionated provisioning
--> Sets up Calcio overlay networking

Tuesday, February 18, 2020

[Solved] Difference between the Variable vs Global variable in Amazon RDS

Recently faced the issue after making changes in the RDS Parameters and querying the same within the mysql rds in the Amazon AWS.

 mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';  
 +--------------------------+-------------------------------------------+  
 | Variable_name      | Value                   |  
 +--------------------------+-------------------------------------------+  
 | character_set_client   | utf8                   |  
 | character_set_connection | utf8                   |  
 | character_set_database  | utf8mb4                  |  
 | character_set_filesystem | binary                  |  
 | character_set_results  | utf8                   |  
 | character_set_server   | utf8mb4                  |  
 | character_set_system   | utf8                   |  
 | character_sets_dir    | /rdsdbbin/mysql-5.7.22.R5/share/charsets/ |  
 | collation_connection   | utf8_general_ci              |  
 | collation_database    | utf8mb4_unicode_ci            |  
 | collation_server     | utf8mb4_unicode_ci            |  
 +--------------------------+-------------------------------------------+  
 11 rows in set (0.01 sec)  
 mysql> SHOW GLOBAL VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';  
 +--------------------------+-------------------------------------------+  
 | Variable_name      | Value                   |  
 +--------------------------+-------------------------------------------+  
 | character_set_client   | utf8mb4                  |  
 | character_set_connection | utf8mb4                  |  
 | character_set_database  | utf8mb4                  |  
 | character_set_filesystem | binary                  |  
 | character_set_results  | utf8mb4                  |  
 | character_set_server   | utf8mb4                  |  
 | character_set_system   | utf8                   |  
 | character_sets_dir    | /rdsdbbin/mysql-5.7.22.R5/share/charsets/ |  
 | collation_connection   | utf8mb4_unicode_ci            |  
 | collation_database    | utf8mb4_unicode_ci            |  
 | collation_server     | utf8mb4_unicode_ci            |  
 +--------------------------+-------------------------------------------+  
 11 rows in set (0.00 sec)  

Cause:-
session variables are getting overridden is because the client auto detects which character set to use based on the operating system setting. 

Reproduce:-
for reproducing the case two different MySQL clients running on separate servers. One was installed on an Ubuntu subsystem running on my local machine and the other was installed on a Ubuntu Linux server running on an EC2 instance. MySQL client running on my local machine the variables were not overridden. However, on the Ubuntu Linux server running on EC2 the session variables got overridden. 

Workaround/Resolution:-
setting the 'skip-character-set-client-handshake' parameter to 1 using you custom parameter group. This will ignore the character set information detected by the client and therefore set the session character set variable to be the same value as your global variables