Posts

Showing posts with the label Start services

Featured Post

Python map() and lambda() Use Cases and Examples

Image
 In Python, map() and lambda functions are often used together for functional programming. Here are some examples to illustrate how they work. Python map and lambda top use cases 1. Using map() with lambda The map() function applies a given function to all items in an iterable (like a list) and returns a map object (which can be converted to a list). Example: Doubling Numbers numbers = [ 1 , 2 , 3 , 4 , 5 ] doubled = list ( map ( lambda x: x * 2 , numbers)) print (doubled) # Output: [2, 4, 6, 8, 10] 2. Using map() to Convert Data Types Example: Converting Strings to Integers string_numbers = [ "1" , "2" , "3" , "4" , "5" ] integers = list ( map ( lambda x: int (x), string_numbers)) print (integers) # Output: [1, 2, 3, 4, 5] 3. Using map() with Multiple Iterables You can also use map() with more than one iterable. The lambda function can take multiple arguments. Example: Adding Two Lists Element-wise list1 = [ 1 , 2 , 3 ]

2 Exclusive Ways to Start Kafka Services

Image
The Kafka services start or stop you can do in two ways. Those are  Systemd  and  Systemctl  (sudo user). Below, you will find the commands for these two methods. How to start/stop Kafka service Here are exclusive ways. With these, you can start or stop Kafka services .   1. Systemd service The concept of unit files people who worked on Linux servers have familiarity with it. Also, they know creating the unit file to use by systemd. To summarize,  it initializes and maintains components throughout the system . This means that you can define ZooKeeper and Kafka as unit files, which then will be used by systems. Commands The first command starts the service, and the second command stops the service. ... [Service] ... ExecStart=/opt/kafkainaction/bin/zookeeper-server-start.sh ExecStop= /opt/kafkainaction/bin/zookeeper-server-stop.sh 2. Systemctl by Sudo (root) user The root user can start or stop the Kafka services. This is more like front-end processing. This way of executing is called