Wednesday, September 28, 2022

Fencing-HA

 

      Fencing

A fencing method is a method by which one node can forcibly prevent another node from making continued progress. This might be implemented by killing a process on the other node, by denying the other node's access to shared storage, or by accessing a PDU to cut the other node's power.

Hadoop NameNode High Availability Architecture



In HDFS NameNode High Availability Architecture, two NameNodes run at the same time. We can Implement the Active and Standby NameNode configuration in following two ways:

 

Ø Using Quorum Journal Nodes

Ø Using Shared Storage

 Using Quorum Journal Nodes

QJM is an HDFS implementation. It is designed to provide edit logs. It allows sharing these edit logs between the active namenode and standby namenode.

For High Availability, standby namenode communicates and synchronizes with the active namenode. It happens through a group of nodes or daemons called “Journal nodes”. The QJM runs as a group of journal nodes. There should be at least three journal nodes.

 

For N journal nodes, the system can tolerate at most (N-1)/2 failures and continue to function. So, for three journal nodes, the system can tolerate the failure of one {(3-1)/2} of them.

When an active node performs any modification, it logs modification to all journal nodes.

The standby node reads the edits from the journal nodes and applies to its own namespace in a constant manner. In the case of failover, the standby will ensure that it has read all the edits from the journal nodes before promoting itself to the Active state. This ensures that the namespace state is completely synchronized before a failure occurs.

To provide a fast failover, the standby node must have up-to-date information about the location of data blocks in the cluster. For this to happen, IP address of both the namenode is available to all the datanodes and they send block location information and heartbeats to both NameNode.

Using Shared Storage

Standby and active namenode synchronize with each other by using “shared storage device”. For this implementation, both active namenode and standby namenode must have access to the particular directory on the shared storage device (.i.e. Network file system).

 

When active namenode perform any namespace modification, it logs a record of the modification to an edit log file stored in the shared directory. The standby namenode watches this directory for edits, and when edits occur, the standby namenode applies them to its own namespace. In the case of failure, the standby namenode will ensure that it has read all the edits from the shared storage before promoting itself to the Active state. This ensures that the namespace state is completely synchronized before failover occurs.

 

To prevent the “split-brain scenario” in which the namespace state deviates between the two namenode, an administrator must configure at least one fencing method for the shared storage.

Both these terms are pertaining to HDFS in Hadoop.

HDFS (Hadoop Distributed File System) is the storage layer of Hadoop which stores large datasets as files in a distributed manner across multiple nodes in a hadoop cluster. A file is divided into blocks and these blocks are stored across multiple nodes in the cluster. HDFS has a master-slave architecture. The NameNode is the master which stores the metadata pertaining to the files, blocks, its location etc.. and DataNode(s) are the slaves which stores the actual data in terms of blocks.

HDFS Federation

NameNode keeps all metadata in main memory as an in-memory image. As the number of files grows in the cluster, it becomes impractical to host entire file namespace in the main memory of a single system. In such a case, the file system namespace is partitioned into namespace volumes. For example, all addresses starting with /usr or /home can be considered as two different volumes managed by two separate namenodes. Each namenode manages a namespace volume and comprises of the metadata for the namespace. The namenodes also manage a block pool containing all the blocks for the files in its namespace. There is no communication between the namenodes and the namenodes operate in isolation. Also, failure of one namenode doesn’t affect the working of other namenodes. The datanodes communicate with all the namenodes present in the cluster. The blocks in a specific data node can map to block pools of any name node.

HA (High Availability) For NameNode

Prior to Hadoop 2.x, only 1 instance of NameNode was supported and hence it was Single Point Of Failure i.e. if the NameNode crashes the entire HDFS is unavailable until the FSImage is reconstructed from the standby NameNode and the NameNode instance is restarted. This introduces considerably down-time and hence the system was not highly available.

From Hadoop 2.x, the support for HA NameNode was introduced where there is a pair of NameNodes in the system out of which one is active and another one is passive. Only the active NameNode manages the HDFS cluster. The passive NameNode keeps monitoring the active NameNode and makes sure it is in sync with the active NameNode. If the active NameNode crashes, the passive NameNode takes over as the active NameNode and continues the functions of HDFS without any down-time as the passive NameNode was always in sync with the active NameNode.

In the failover scenario, it is important to make sure that only one NameNode is active. At no point in time, there should be more than 1 active NameNodes. More than 1 active NameNodes results in a split-brain scenario.

Fencing is a technique using which it is ensured that only 1 NameNode is active. The most popular approach is to use Quoram Journal Nodes to implement fencing.

 

Hardware resources

In order to deploy an HA cluster, you should prepare the following:

 

NameNode machines - the machines on which you run the Active and Standby NameNodes should have equivalent hardware to each other, and equivalent hardware to what would be used in a non-HA cluster.

 

Shared storage - you will need to have a shared directory which both NameNode machines can have read/write access to. Typically this is a remote filer which supports NFS and is mounted on each of the NameNode machines. Currently only a single shared edits directory is supported. Thus, the availability of the system is limited by the availability of this shared edits directory, and therefore in order to remove all single points of failure there needs to be redundancy for the shared edits directory. Specifically, multiple network paths to the storage, and redundancy in the storage itself (disk, network, and power). Beacuse of this, it is recommended that the shared storage server be a high-quality dedicated NAS appliance rather than a simple Linux server.

Note that, in an HA cluster, the Standby NameNode also performs checkpoints of the namespace state, and thus it is not necessary to run a Secondary NameNode, CheckpointNode, or BackupNode in an HA cluster. In fact, to do so would be an error. This also allows one who is reconfiguring a non-HA-enabled HDFS cluster to be HA-enabled to reuse the hardware which they had previously dedicated to the Secondary NameNode.

 YouTube link: Hadoop series 1 - YouTube

 Follow 👉 syed ashraf quadri👈 for awesome stuff

Tuesday, September 27, 2022

Hadoop Interview questions

https://youtu.be/__SBjmHEBfY 


 https://www.linkedin.com/posts/syedashrafcloud_hadoop-questions-with-answer-about-108-with-activity-6980518517129293824-w8xk?utm_source=share&utm_medium=member_desktop

Friday, September 23, 2022

snowflake


Time is Up
score:
Next Question

Results

Total Questions:

Attempt:

Correct:

Wrong:

Percentage:

Tuesday, September 20, 2022

Grafana Features

 Grafana Features

 

 Cloud integrations

 Grafana Cloud is greater than the sum of its features. Seamlessly switch between metrics, logs, and traces. Correlate data and get to the root cause more easily and quickly. Reduce mean time to recovery (MTTR) and de-risk feature launches. Give your team the tools they want to use. Focus on what you do best; leave the platform to us. The Grafana and Prometheus open source projects are de facto standards for observability, with wide grassroots adoption. Both are easy to get started with and to use. But it can take weeks to get the best out of a complete integrated stack — including logs, traces, an agent, dashboards, alerts, etc. — and not every organization has the time and resources to do this. Grafana Cloud comes with an ever-expanding set of pre-built integrations to get the most out of these technologies quickly and easily. Start monitoring popular infrastructure components such as MySQL, Postgres, Redis, or Memcache with just a few clicks. Choose from preconfigured dashboards and alerts, and use our comprehensive agents to gather important metrics, logs, and traces in one place.

 

Cloud dashboards (Grafana)

 Grafana is at the center of every Grafana Cloud stack. Grafana allows you to query, visualize, alert on, and understand your metrics no matter where they are stored. Create, explore, and share beautiful dashboards with your team and foster a data-driven culture. The Grafana Cloud Pro plan includes features previously reserved for Grafana Enterprise customers, including data source permissions, reporting, and usage insights. As with every service in Grafana Cloud, we take care of making your Grafana securely available over the internet, avoiding the need to deal with firewalls and set up SSL. Grafana Cloud is operated by our expert team with 24x7, follow-the-sun on-call coverage and backed by our SLA. We handle all the reliability, availability, and scalability aspects of your Grafana instance. We ensure every user stays up to date with the latest features by seamlessly upgrading to the most recent release.

Cloud metrics

 

Prometheus is the de facto standard monitoring system for cloud native applications and infrastructure. With its pull-based collection, Prometheus offers cloud native, vertically scalable monitoring for your application. But federating together multiple Prometheus instances across many regions can be complicated and time consuming. And horizontally sharding Prometheus servers as your deployment grows takes time and understanding. Included in your Grafana Cloud stack is a massively scalable, high-performance, and highly available Prometheus instance. Bring together the raw, unsampled metrics for all your applications and infrastructure, spread around the globe, in one place. Query high cardinality data with blazing fast PromQL and Graphite queries. Centralize the analysis, visualization, and alerting on all of your metrics. Grafana Cloud’s default 13-month retention (in the Pro plan) allows you to combine application and infrastructure metrics for use cases such as capacity planning.

Cloud logs

 

The move to cloud native and microservice-based architectures has led to an explosion in the volume of logs. At the same time, continuous integration and deployment are allowing developers to iterate faster and take more risks. For many developers, logs are an “insurance policy”; applications will fail in new and exciting ways, and good logs will allow you to figure them out. Therefore to move quickly with complex architectures, you need a high-volume, cost-effective log aggregation system. Grafana Cloud’s logging service is powered by Grafana Loki, our Prometheus-inspired log aggregation project. Our high-performance system allows you to bring together logs from all your applications and infrastructure in a single place. By using the exact same service discovery as Prometheus, Loki can systematically guarantee your logs have consistent labels with your metrics. This allows you to seamlessly switch between metrics and logs, preserving context and saving time. Loki’s LogQL query language allows you to apply all the knowledge and skills learned from Prometheus’s PromQL and query your logs in the same way you would query your Prometheus metrics. Extract and analyze metrics derived from log data — useful for legacy applications that don’t expose metrics.

Cloud traces

 

The popularity of the microservices architecture pattern has led to an increase in complexity — a single request can now involve many tens or hundreds of individual services. It can sometimes be tricky or impossible to attribute latency spikes and errors to a single service; long-tail latency can often be caused by the emergent behavior of hundreds or thousands of services. Traditional debugging and profiling tools cannot capture the whole picture. Distributed tracing is a powerful technique for diagnosing latency and errors in these architectures. Visualize the flow of a request as it traverses multiple services, identify where problems start, and root out the cause. Powered by Grafana Tempo, Grafana Cloud provides an easy-to-use, highly scalable, and cost-effective distributed tracing system. A common technique for controlling the resource usage of many systems is sampling: only recording traces for a subset of your requests. But what if the request you want to investigate wasn’t sampled? Tempo doesn’t index the traces — making it possible to store orders of magnitude more trace data for the same cost, and removing the need for sampling. Tempo instead relies on deep integrations within Grafana to allow you to pivot seamlessly between metrics, logs, and traces — for example, leveraging your existing logs to find the trace you care about.

Cloud alerting

 

Prometheus and Alertmanager offer some of the most powerful alerting capabilities available. A single, consistent alerting rule can generate multiple notifications, powered by Prometheus’s multi-dimensional, label-based data model. Alertmanager can use these labels to route notifications for the same alert rule to different teams. Alertmanager can also group and deduplicate notifications together into a single email to reduce interruptions. With the open source tools, all of this power is controlled by a set of YAML-based configuration files, loaded on the same machine as Prometheus and Alertmanager. But often the team that wants to build alerting rules is different from the team that manages the Prometheus servers.

With Grafana Cloud alerting, a simple UI embedded right in your Grafana instance can be used to manage alerts — allowing your alerting to become self-service. Create, manage, and silence all of your alerts within one simple Grafana Cloud alerting page. All these options are also available via a RESTful API with tooling to enable a GitOps-style workflow.

Grafana Cloud also allows Prometheus-style alerting on the contents of the logs. A unified experience allows you to manage alerting rules for both metrics and logs directly in Grafana. This is especially useful for third-party systems that don’t export metrics.

Synthetic monitoring

 

Monitoring your service from within your own infrastructure allows you to get detailed insights into its behavior. But it can’t tell you how your service is performing from outside your infrastructure, or from the other side of the world. Getting these signals requires a large deployment of probes throughout the world, hosted on many providers. Deploying, maintaining, and upgrading these seldom represents a good investment for a single organization. Let Grafana Cloud manage them for you with synthetic monitoring. Observe how systems and applications are performing from a user’s point of view by monitoring applications and API endpoints from dozens of locations around the world. We deploy the open-source Prometheus blackbox exporter and provide a simple management UI and API for you to configure them. Continually test remote targets using HTTP/HTTPS, DNS, TCP, and ICMP Ping to assess the availability, performance, and correctness of your service.

 

Grafana Agent

The Grafana Agent is a lightweight collector for sending telemetry data to Grafana Cloud. We combine everything that’s needed to gather metrics, logs, and traces into a single package, simplifying deployment and management:

For metrics, Grafana Agent uses the service discovery, relabeling, WAL, and remote_write code from Prometheus. For logs, we embed Loki's Promtail agent, which enables systematically consistent labels between your metrics and logs. For traces, we embed the OpenTelemetry Collector. As part of our effort to reduce the number of packages to install and manage, the Grafana Agent also embeds a number of Prometheus exporters. These allow you to natively bring metrics in from third-party systems, including node_exporter, mysqld_exporter, postgres_exporter, redis_exporter, and many more.

Grafana Machine Learning

Use Grafana Machine Learning to run modern data science techniques on your Grafana Cloud metrics.

You can visualize the predictions, and you can solve real-world problems. For example:

·         Adaptive alerting - alerts that follow the natural ebb and flow of your systems.

·         Anomaly detection - detect the unexpected.

·         Capacity planning - Automatically anticipate when you need to scale up and down.

With just a few clicks, anybody can train ML models capable of making confident predictions into the future.

 

Grafana OnCall

 

Grafana OnCall is an easy-to-use on-call management tool built to help DevOps and site reliability engineering (SRE) teams improve their collaboration and ultimately resolve incidents faster — right within Grafana Cloud.

With Grafana OnCall, teams will no longer have to manage separate alerts from Grafana, Prometheus, and Alertmanager, lowering the risk of missing an important update while also limiting the time spent receiving and responding to notifications. OnCall is easily integrated into Grafana Cloud deployments and works with existing alerting sources and monitoring tools, so teams can get up and running quickly and easily.

External data source plugins

 

The Grafana instance at the center of your Grafana Cloud stack can bring together data from over 60 different data sources and visualize them side-by-side on the same dashboard — including data not hosted on Grafana Cloud.


 


  Adding data sources within your Grafana Cloud account is as simple as one click. Leave your data where it is and get full visibility into your application stack with data source plugins

 YouTube link: Hadoop series 1 - YouTube

follow 👉 syed ashraf quadri👈  for awesome stuff 



Monday, September 19, 2022

#hive-important-question-1

 #hive-important-question-1

what is location of hive log file ?
answer:
Hive logs are stored in the following directories on the cluster's master node. For more information, see View log files on the master node.
/mnt/var/log/hive/
/mnt/var/log/hive/user/

another alternative :
Execute the query with below command



hive --hiveconf hive.root.logger=DRFA --hiveconf hive.log.dir=./logs --hiveconf hive.log.level=DEBUG -e "select foo, count(*) from table where field=value group by foo"


It will create a log file in logs folder. Make sure that the logs folder exist in current directory.
YouTube link: Hadoop series 1 - YouTube
 Follow 👉 syed ashraf quadri👈 for awesome stuff


What is Grafana?

 Grafana open source software enables you to query, visualize, alert on, and explore your metrics, logs, and traces wherever they are stored. Grafana OSS provides you with tools to turn your time-series database (TSDB) data into insightful graphs and visualizations .one of the biggest highlights of grifana is the ability to bring several data sources together in one dashboard with adding rows that will host individual panels that is each with visual type .

After you have installed Grafana and set up your first dashboard , you will have many options to choose from depending on your requirements.

For example, if you want to view weather data and statistics about your smart home, then you can create a playlist. If you are the administrator for an enterprise and are managing Grafana for multiple teams, then you can set up provisioning and authentication.

An overview of Grafana features 

Explore metrics, logs, and traces

Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side. Refer to Explore for more information.

Alerts

Alert hooks allow you to create different notifiers with a bit of code if you prefer some other channels of communication.

By using Grafana alerting, you can have alerts sent through a number of different notifiers, including PagerDuty, SMS, email, or Slack.

Annotations

which shows up as a graph marker in Grafana, is useful for correlating data in case something goes wrong. You can create the annotations manually—just control-click on a graph and input some text—or you can fetch data from any data source.

Configure Grafana

  1. Kiosk mode and playlists: If you want to display your Grafana dashboards on a TV monitor, you can use the playlist feature to pick the dashboards that you or your team need to look at through the course of the day and have them cycle through on the screen. The kiosk mode hides all the user interface elements that you don't need in view-only mode. Helpful hint: The Grafana Kiosk utility handles logging in, switching to kiosk mode, and opening a playlist—eliminating the pain of logging in on a TV that has no keyboard.
  2. Custom plugins: Plugins allow you to extend Grafana with integrations with other tools, different visualizations, and more. Some of the most popular in the community are Worldmap Panel (for visualizing data on top of a map), Zabbix (an integration with Zabbix metrics), and Influx Admin Panel (which offers other functionality like creating databases or adding users). But they're only the tip of the iceberg. Just by writing a bit of code, you can get anything that produces a timestamp and a value visualized in Grafana. Plus, Grafana Enterprise customers have access to more plugins for integrations with Splunk, Datadog, New Relic, and others.
  3. Alerting and alert hooks: If you're using Grafana alerting, you can have alerts sent through a number of different notifiers, including PagerDuty, SMS, email, or Slack. Alert hooks allow you to create different notifiers with a bit of code if you prefer some other channels of communication.
  4. Permissions and teams: When organizations have one Grafana and multiple teams, they often want the ability to both keep things separate and share dashboards. Early on, the default in Grafana was that everybody could see everyone else's dashboards, and that was it. Later, Grafana introduced multi-tenant mode, in which you can switch organizations but can't share dashboards. Some people were using huge hacks to enable both, so Grafana decided to officially create an easier way to do this. Now you can create a team of users and then set permissions on folders, dashboards, and down to the data source level if you're using Grafana Enterprise.
  5. SQL data sources: Grafana's native support for SQL helps you turn anything—not just metrics—in an SQL database into metric data that you can graph. Power users are using SQL data sources to do a whole bunch of interesting things, like creating business dashboards that "make sense for your boss's boss," as the team at Percona put it. Check out their presentation at GrafanaCon.
  6. Monitoring your monitoring: If you're serious about monitoring and you want to monitor your own monitoring, Grafana has its own Prometheus HTTP endpoint that Prometheus can scrape. It's quite simple to get dashboards and statics. There's also an enterprise version in development that will offer Google Analytics-style easy access to data, such as how much CPU your Grafana is using or how long alerting is taking.
  7. Authentication: Grafana supports different authentication styles, such as LDAP and OAuth, and allows you to map users to organizations. In Grafana Enterprise, you can also map users to teams: If your company has its own authentication system, Grafana allows you to map the teams in your internal systems to teams in Grafana. That way, you can automatically give people access to the dashboards designated for their teams.      
 YouTube link: Hadoop series 1 - YouTube
 Follow 👉 syed ashraf quadri👈 for awesome stuff