Friday 18 August 2023

To Become Devops Engineer Need to Know Below Concept

Cloud Computing:

Develop a strong understanding of cloud computing platforms such as Amazon Web Services (AWS), Microsoft Azure, or Google Cloud Platform (GCP). Learn how to deploy, manage, and scale applications in the cloud, utilize cloud services, and optimize infrastructure for performance and cost-efficiency.
  • Amazon Web Services
  • Microsoft Azure
  • Google Cloud Platform

Configuration Management:

Gain expertise in configuration management tools like Ansible, Puppet, or Chef. Learn how to automate the provisioning, configuration, and management of infrastructure and applications to achieve consistency and repeatability.
  • Ansible
  • Puppet
  • Chef

Continuous Integration and Deployment (CI/CD):

Understand CI/CD principles and Master the process of automating software builds, testing, and deployment to enable fast and frequent delivery of high-quality software.

  • Jenkins, 
  • GitLab CI/CD, 
  • CircleCI. 

Containerization:

Learn containerization technologies like Docker and container orchestration platforms like Kubernetes. Understand how to create, deploy, and manage containers to achieve scalability, portability, and resource efficiency.
  • Docker
  • Kubernetes

Infrastructure as Code (IaC):

Familiarize yourself with Infrastructure as Code tools like Terraform or CloudFormation. Learn how to define and manage infrastructure using code, enabling reproducibility, version control, and automated provisioning.
  • Terraform
  • CloudFormation
Monitoring and Logging:

Gain expertise in monitoring tools such as Prometheus, Grafana, or Datadog. Learn how to monitor and analyze system performance, set up alerts, and troubleshoot issues. Understand logging frameworks like ELK (Elasticsearch, Logstash, Kibana) stack to aggregate and analyze logs.
  • Prometheus
  • Grafana
  • Datadog
  • Cloudwatch
  • Sumolog
Security and Compliance:

Acquire knowledge of security best practices and compliance frameworks like PCI-DSS or GDPR. Learn about securing infrastructure, implementing access controls, and managing secrets. Understand the importance of secure coding practices and vulnerability scanning.

Scripting and Automation:

Develop proficiency in scripting languages like Python, Ruby, or Bash. Automate repetitive tasks, write scripts for infrastructure management, and integrate various tools and systems.

Collaboration and Communication:

Enhance your communication and collaboration skills to work effectively with cross-functional teams. Practice effective documentation, participate in code reviews, and contribute to a collaborative work environment.

Problem-Solving and Troubleshooting:

Cultivate strong problem-solving and troubleshooting abilities. Develop a systematic approach to identifying and resolving issues, both at the application and infrastructure levels.

Monday 30 January 2023

𝗦𝘆𝘀𝘁𝗲𝗺 𝗗𝗲𝘀𝗶𝗴𝗻 𝗠𝗮𝘀𝘁𝗲𝗿 𝗧𝗲𝗺𝗽𝗹𝗮𝘁𝗲: 𝗢𝗻𝗲 𝗧𝗲𝗺𝗽𝗹𝗮𝘁𝗲 𝘁𝗼 𝗥𝘂𝗹𝗲 𝗧𝗵𝗲𝗺 𝗔𝗹𝗹.

𝗦𝘆𝘀𝘁𝗲𝗺 𝗗𝗲𝘀𝗶𝗴𝗻 𝗠𝗮𝘀𝘁𝗲𝗿 𝗧𝗲𝗺𝗽𝗹𝗮𝘁𝗲: 𝗢𝗻𝗲 𝗧𝗲𝗺𝗽𝗹𝗮𝘁𝗲 𝘁𝗼 𝗥𝘂𝗹𝗲 𝗧𝗵𝗲𝗺 𝗔𝗹𝗹.

I've used this template to discuss many #systemdesign problems in #interviews.

This template serves as a list of things that can be discussed during the interview.

Keep it handy. ✨


Here is a brief introduction of some of the components involved:

𝗔𝗣𝗜 𝗚𝗮𝘁𝗲𝘄𝗮𝘆
An API Gateway (AG) is a server that acts as a single point of entry for a set of #microservices. AG receives client requests, forwards them to the appropriate microservice, and then returns the server's response to the client. AG is responsible for tasks such as routing, authentication, and rate limiting.


𝗖𝗗𝗡
A Content Delivery Network (CDN) is a distributed network of servers that are deployed in multiple locations around the world. These servers are designed to deliver web content, such as images, videos, and other static files, to users based on their geographical location. The main purpose of a #cdn is to improve the performance and availability of web content by caching it on servers that are closer to the users who are requesting it.


𝗗𝗮𝘁𝗮 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴
In a database, 𝗵𝗼𝗿𝗶𝘇𝗼𝗻𝘁𝗮𝗹 𝗽𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴, also known as sharding, involves dividing the rows of a table into smaller tables and storing them on different servers or database instances. This is done to distribute the load of a database across multiple servers and to improve performance.

On the other hand, 𝘃𝗲𝗿𝘁𝗶𝗰𝗮𝗹 𝗽𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴 involves dividing the columns of a table into separate tables. This is done to reduce the number of columns in a table and to improve the performance of queries that only access a small number of columns.


𝗗𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱 𝗺𝗲𝘀𝘀𝗮𝗴𝗶𝗻𝗴 𝘀𝘆𝘀𝘁𝗲𝗺𝘀 
These are used to send messages between distributed components of a system. Examples include Apache #kafka and #rabbitmq.


𝗗𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱 𝗳𝗶𝗹𝗲 𝘀𝘆𝘀𝘁𝗲𝗺𝘀
These are file systems that are designed to store and manage files across a group of servers.


𝗡𝗼𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻𝘀 𝘀𝘆𝘀𝘁𝗲𝗺
These are used to send notifications or alerts to users, such as emails, push notifications, or text messages.


𝗙𝘂𝗹𝗹-𝘁𝗲𝘅𝘁 𝘀𝗲𝗮𝗿𝗰𝗵
Full-text search enables users to search for specific words or phrases within an app or website. When a user queries, the app or website returns the most relevant results. To do this quickly and efficiently, full-text search relies on an inverted index, which is a data structure that maps words or phrases to the documents in which they appear.


Ref:
✅System Design Survival Guide (2023): https://lnkd.in/deqz6gnz
✅Take a look at 𝗚𝗿𝗼𝗸𝗸𝗶𝗻𝗴 𝘁𝗵𝗲 𝗦𝘆𝘀𝘁𝗲𝗺 𝗗𝗲𝘀𝗶𝗴𝗻 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 for #systemdesign #interview questions - https://lnkd.in/g4Wii9r7
✅For software architecture, take a look at 𝗚𝗿𝗼𝗸𝗸𝗶𝗻𝗴 𝘁𝗵𝗲 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗦𝘆𝘀𝘁𝗲𝗺 𝗗𝗲𝘀𝗶𝗴𝗻 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 - https://lnkd.in/dyCRtiec



Wednesday 20 March 2019

Find the total views on each database

if object_ID('TempDB..#AllTables','U') IS NOT NULL drop table #AllTables
CREATE TABLE #AllTables (
  [DB Name] sysname, 
  [Views] int)

DECLARE @SQL NVARCHAR(MAX)

SELECT @SQL = COALESCE(@SQL,'') + 'USE ' + quotename(name) + '
insert into #AllTables 
select ' + QUOTENAME(name,'''') + ' as [DB Name],     
    (select count(*) from ' + QUOTENAME(Name) + '.sys.views)
 '
FROM sys.databases
where state_desc = 'ONLINE'
ORDER BY name
-- print @SQL -- debug 
EXECUTE(@SQL)
SELECT * FROM #AllTables order by Views desc

Wednesday 26 December 2018

How to move files from one git repo to another (not a clone), preserving history

Method#1

If your history is same, you can take the commits out as patch and apply them in the new repository:

cd repository
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch
cd ../another_repository
git am < ../repository/patch

referred from : https://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-another-not-a-clone-preserving-history

Saturday 5 August 2017

Enabling CLR Integration


CLR (Common Language Runtime) Integration

Microsoft SQL Server now features the integration of the common language runtime (CLR) component of the .NET Framework for Microsoft Windows. The CLR supplies managed code with services such as cross-language integration, code access security, object lifetime management, and debugging and profiling support. For SQL Server users and application developers, CLR integration means that you can now write stored procedures, triggers, user-defined types, user-defined functions (scalar and table-valued), and user-defined aggregate functions using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#. Note that Visual Studio .NET 2003 cannot be used for CLR integration programming. SQL Server includes the .NET Framework version 2.0 SP1 pre-installed, and Visual Studio .NET 2003 cannot use the .NET Framework 2.0 assemblies.


The common language runtime (CLR) integration feature is off by default, and must be enabled in order to use objects that are implemented using CLR integration. To enable CLR integration, use the clr enabled option of the sp_configure stored procedure:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO
You can disable CLR integration by setting the clr enabled option to 0. When you disable CLR integration, SQL Server stops executing all CLR routines and unloads all application domains.
NoteNote
To enable CLR integration, you must have ALTER SETTINGS server level permission, which is implicitly held by members of the sysadmin and serveradmin fixed server roles.
Note
Computers configured with large amounts of memory and a large number of processors may fail to load the CLR integration feature of SQL Server when starting the server. To address this issue, start the server by using the -g memory_to_reserve SQL Server service startup option, and specify a memory value large enough. For more information, see Using the SQL Server Service Startup Options.
Note
Common language runtime (CLR) execution is not supported under lightweight pooling. Before enabling CLR integration, you must disable lightweight pooling. For more information, see lightweight pooling Option.

Friday 4 August 2017

SQL Server – Alter database in Single User mode to Multi User mode

Refereed from
https://myadventuresincoding.wordpress.com/2014/03/06/sql-server-alter-database-in-single-user-mode-to-multi-user-mode/

We have some test environment databases that get rebuilt nightly. The job that does the rebuild always switches the database into single user mode when it is being rebuilt. When the rebuild is finished it will switch it back to multi user mode. However, if there was a problem with a script and the job failed, it will leave the database in single user mode.
First, open a SQL Server Management Studio query window connected to database “master”.


The command to change the database back to multi user mode is:
ALTER DATABASE {InsertDatabaseNameHere} SET MULTI_USER WITH ROLLBACK IMMEDIATE GO


However, if there is an existing process blocking this alter, you may get the error message:
“Transaction (Process ID 864) was deadlocked on lock resources with another process and has been chosen as the deadlock victim”
Since both the existing running process and the current request have the same deadlock priority, preference is given to the longer running process which is why your alter database command is chosen as the deadlock victim. So to deal with this when you run the command again, set the deadlock priority to HIGH. However, if that does not work, you will need to kill the existing connection.
To find the “spid” of the existing connection, you can use the following query:
SELECT sd.[name], sp.spid, sp.login_time, sp.loginame
FROM sysprocesses sp
INNER JOIN sysdatabases sd on sp.dbid = sd.dbid 
WHERE sd.[name] = 'DatabaseNameGoesHere'
As an alternative, you can also use the command “sp_who” to get the “spid” of the open connection:
exec sp_who
So, here is our revised command:
KILL SpidToKillGoesHere
GO
SET DEADLOCK_PRIORITY HIGH
GO
ALTER DATABASE DatabaseNameGoesHere SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
That should do it!

Thursday 29 June 2017

Disconnect sessions from multiple servers using powershell script

function Get-Sessions { $queryResults = query session /SERVER:$srv echo "Server $srv is reachable, collecting sessions" $starters = New-Object psobject -Property @{"SessionName" = 0; "UserName" = 0; "ID" = 0; "State" = 0; "Type" = 0; "Device" = 0;} foreach ($result in $queryResults) { try { if($result.trim().substring(0, $result.trim().indexof(" ")) -eq "SESSIONNAME") { $starters.UserName = $result.indexof("USERNAME"); $starters.ID = $result.indexof("ID"); $starters.State = $result.indexof("STATE"); $starters.Type = $result.indexof("TYPE"); $starters.Device = $result.indexof("DEVICE"); continue; } New-Object psobject -Property @{ "SessionName" = $result.trim().substring(0, $result.trim().indexof(" ")).trim(">"); "Username" = $result.Substring($starters.Username, $result.IndexOf(" ", $starters.Username) - $starters.Username); "ID" = $result.Substring($result.IndexOf(" ", $starters.Username), $starters.ID - $result.IndexOf(" ", $starters.Username) + 2).trim(); "State" = $result.Substring($starters.State, $result.IndexOf(" ", $starters.State)-$starters.State).trim(); "Type" = $result.Substring($starters.Type, $starters.Device - $starters.Type).trim(); "Device" = $result.Substring($starters.Device).trim() } } catch { $e = $_; echo "ERROR: on $srv" + $e.PSMessageDetails } } } $servers = "SERVERNAME1","SERVERNAME2","SERVERNAME3" foreach($srv in $servers) { [string]$IncludeStates = '^(Disc)$' echo "Sessions CleanUp on Server $srv" echo "=============================" $DisconnectedSessions = Get-Sessions| ? {$_.UserName -ne ""} | Select ID, UserName foreach ($session in $DisconnectedSessions) { logoff $session.ID /SERVER:$srv echo $session.Username } echo "=============================" echo " " }