Member since
01-19-2017
3682
Posts
633
Kudos Received
373
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 2002 | 06-04-2025 11:36 PM | |
| 2340 | 03-23-2025 05:23 AM | |
| 1126 | 03-17-2025 10:18 AM | |
| 4435 | 03-05-2025 01:34 PM | |
| 2965 | 03-03-2025 01:09 PM |
04-29-2018
06:09 AM
@Sriram Hadoop Nice to know it has answered your question. Could you Accept the answer I gave by Clicking on Accept button below, That would be a great help to Community users to find the solution quickly for these kinds of errors.
... View more
04-27-2018
12:48 PM
@Sriram Hadoop Once you have changed the block size at the cluster level, whatever files you put or copy to hdfs will have the new default block size of 256 MB Unfortunately, apart from DISTCP you have the usual -put and -get HDFS commands My default blocksize is 128MB see attached screenshot 128MB.JPG Created a file test_128MB.txt $ vi test_128MB.txt Uploaded a 128 MB files to HDFS $ hdfs dfs -put test_128MB.txt /user/sheltong see attached screenshot 128MB.JPG notice the block size I then copied the same file back to the local filesystem, $ hdfs dfs -get /user/sheltong/test_128MB.txt /tmp/test_128MB_2.txt The using the -D option to define a new blocksize of 256 MB $ hdfs dfs -D dfs.blocksize=268435456 -put test_128MB_2.txt /user/sheltong See screenshot 256MB.JPG, technically its possible if you have a few files but you should remember the test_128MB.txt and test_128MB_2.txt are the same files of 128MB, so changing the blocksize of an existing files with try to fit a 128bock in a 256 MB block leading to wastage of space of the other 128MB, hence the reason it will ONLY apply to new files. Hope that gives you a better understanding
... View more
04-27-2018
06:22 AM
@Sriram Hadoop Hadoop Distributed File System was designed to hold and manage large amounts of data; therefore typical HDFS block sizes are significantly larger than the block sizes you would see for a traditional filesystem the block size is specified in hdfs-site.xml. The default block size in Hadoop 2.0 is 128mb, to change to 256MB edit the parameter, dfs.block.size to change to the desired block size eg 256 MB and you will need to restart all the stale services for the change to take effect. It's recommended to always use Ambari UI to make HDP/HDF changes Existing files' block size can't be changed, In order to change the existing files' block size, 'distcp' utility can be used. or Override the default block size with 265 MB hadoop fs -D dfs.blocksize=268435456 -copyFromLocal /tmp/test/payroll-april10.csv blksize/payroll-april10.csv Hope that helps
... View more
03-15-2018
02:43 PM
@Mudassar Hussain I am positive that command should and will work without fail if you have successfully created a snapshottable directory. Its a sub command of hdfs can you simply run hdfs a the hdfs user? $ hdfs Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND
where COMMAND is one of:
dfs run a filesystem command on the file systems supported in Hadoop.
classpath prints the classpath
namenode -format format the DFS filesystem
secondarynamenode run the DFS secondary namenode
namenode run the DFS namenode
journalnode run the DFS journalnode
.......
........
snapshotDiff diff two snapshots of a directory or diff the current directory contents a snapshot
lsSnapshottableDir list all snapshottable dirs owned by the current user
Use -help to see options
....
Most commands print help when invoked w/o parameters. Now once you have confirmed the above run as below # su - hdfs
$ hdfs lsSnapshottableDir
output ..........................
drwxr-xr-x 0 mudassar hdfs 0 2018-03-15 10:38 1 65536 /user/mudassar/snapdemo That the directory I created to reproduce your issues on my cluster.
... View more
03-15-2018
10:05 AM
@Mudassar Hussain The steps 1,2 and 3 are okay.You dont need to create directory2, when you enable a directory as snapshottable in this case /user/mudassar/snapdemo the snapshots will be created under this directory with .snapshot....... which makes it invisible when you run the hdfs dfs -ls command Let me demo on HDP 2.6 I will create your user on my local environment. As mudassar as the root user # adduser mudassar Switch to superuser and owner of HDFS # su - hdfs Create the snapshot demo notice the -p option as the root directory /user/mudassar doesn't exist yet Note: hdfs hadoop will be deprecated so use hdfs dfs command! $ hdfs dfs -mkdir -p /user/mudassar/snapdemo Validate directory $ hdfs dfs -ls /user/mudassar
Found 1 items
drwxr-xr-x - hdfs hdfs 0 2018-03-15 09:39 /user/mudassar/snapdemo Change ownership to mudassar $ hdfs dfs -chown mudassar /user/mudassar/snapdemo Validate change of ownership $ hdfs dfs -ls /user/mudassar
Found 1 items
drwxr-xr-x - mudassar hdfs 0 2018-03-15 09:39 /user/mudassar/snapdemo Make the directory snapshottable $ hdfs dfsadmin -allowSnapshot /user/mudassar/snapdemo
Allowing snaphot on /user/mudassar/snapdemo succeeded Show all the snapshottable directories in your cluster a subcommand under hdfs $ hdfs lsSnapshottableDir
drwxr-xr-x 0 mudassar hdfs 0 2018-03-15 09:39 0 65536 /user/mudassar/snapdemo Create 2 sample files in /tmp $ echo "Test one for snaphot No worries No worries I was worried you got stuck and didn't revert the HCC is full of solutions so" > /tmp/text1.txt
$ echo "The default behavior is that only a superuser is allowed to access all the resources of the Kafka cluster, and no other user can access those resources" > /tmp/text2.txt Validate the files were created $cd /tmp
$ls -lrt
-rw-r--r-- 1 hdfs hadoop 121 Mar 15 10:04 text1.txt
-rw-r--r-- 1 hdfs hadoop 152 Mar 15 10:04 text2.txt Copy the files from locall to HDFS $ hdfs dfs -put text1.txt /user/mudassar/snapdemo Create a snapshot of the file text1.txt $ hdfs dfs -createSnapshot /user/mudassar/snapdemo
Created snapshot /user/mudassar/snapdemo/.snapshot/s20180315-101148.262 Note above the .snapshot directory which is a hidden system directory Show the snapshot of text1.txt $ hdfs dfs -ls /user/mudassar/snapdemo/.snapshot/s20180315-101148.262
Found 1 items
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/.snapshot/s20180315-101148.262/text1.txt Copied the second file text2.txt from local /tmp to HDFS $ hdfs dfs -put text2.txt /user/mudassar/snapdemo Validation that the 2 files should be resent $ hdfs dfs -ls /user/mudassar/snapdemo
Found 2 items
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/text1.txt
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt Demo simulate loss of file text1.txt $ hdfs dfs -rm /user/mudassar/snapdemo/text1.txt Indeed file text1.txt was deleted ONLY text2.txt remains $ hdfs dfs -ls /user/mudassar/snapdemo
Found 1 items
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt Restore the text1.txt $ hdfs dfs -cp -ptopax /user/mudassar/snapdemo/.snapshot/s20180315-101148.262/text1.txt /user/mudassar/snapdemo To use -ptopax this ensure the timestamp is restored you will need to set the dfs.namenode.accesstime.precision to default 1 hr which is 360000 seconds Check the original timestamp for text1.txt above !!! hdfs dfs -ls /user/mudassar/snapdemo
Found 2 items
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/text1.txt
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt In a nutshell, you don't need to create directory2 because when you run hdfs dfs -createSnapshot command it autocreates a directory under the original starting with .snapshot, that also saves you from extra steps of creating sort of a backup directory. I hope that explains it clearly this time
... View more
03-11-2018
07:22 PM
@Mudassar Hussain No worries I was worried you got stuck and didn't revert the HCC is full of solutions so, don't hesitate to update the thread if you encounter any problems but if the solution provided resolves your issue then that's great what you need to do is accept and close the thread Cheers
... View more
03-09-2018
05:33 PM
@Mudassar Hussain You haven't given your feedback on the method and solution I provided, you should understand that members go a long way to help out and feedback as to whether the solution resolved your problem is appreciated and in that case you accept the answer to reward the user and close the thread,so that others with a similar problem could use it as a SOLUTION.
... View more
03-08-2018
09:40 AM
In this examples I am using a Cloudera virtual box but it the same command on HDP.
I didn't create a local user mudassar but used hdfs and the hdfs directory ################################# # Whoami ################################# # id
uid=0(root) gid=0(root) groups=0(root) ################################# # Switched to hdfs user ################################# # su - hdfs ################################# # Changed directory to tmp to create test files ################################# $ cd /tmp ################################# # Created first file ################################# $ echo "This is the first text file for mudassar to test snapshot" > text1.txt ################################# # Created second file ################################# $ echo "Apache Kafka comes with a pluggable authorizer known as Kafka Authorization Command Line (ACL) Interface, which is used for defining users and allowing or denying them to access its various APIs. The default behavior is that only a superuser is allowed to access all the resources of the Kafka cluster, and no other user can access those resources if no proper ACL is defined for those users. The general format in which Kafka ACL is defined is as follows" > text2.txt ################# # Here is output ################ $ ls -lrt
-rw-rw-r-- 1 hdfs hdfs 58 Mar 8 00:34 text1.txt
-rw-rw-r-- 1 cloudera hdfs 456 Mar 8 00:37 text2.txt ################################# # Above I changed the owner of text2.txt to cloudera as root user in the local filesystem ################################# #chown cloudera:hdfs /tmp/text2.txt ################################ # First create a target directory in hdfs ################################ hdfs dfs -mkdir /user/mudassar ################################ # create a snapshottable directory ################################# hdfs dfsadmin -allowSnapshot /user/mudassar output: Allowing snaphot on /user/mudassar succeeded ################################# # Check the snapshottable dir in HDFS ################################# hdfs lsSnapshottableDir Output drwxr-xr-x 0 hdfs supergroup 0 2018-03-08 00:54 0 65536 /user/mudassar ################################# # copy a file from local to the HDFS snapshotable directory ################################# hdfs dfs -put /tmp/text1.txt /user/mudassar ################################# # Validate the files was copied ################################# hdfs dfs -ls /user/mudassar Found 1 items
-rw-r--r-- 1 hdfs supergroup 58 2018-03-08 00:55 /user/mudassar/text1.txt
################################# # create snapshot ################################# hdfs dfs -createSnapshot /user/mudassar Output
Created snapshot /user/mudassar/.snapshot/s20180308-005619.181 ################################# # Check to see the snapshot ################################# hdfs dfs -ls /user/mudassar/.snapshot Output
Found 1 items
drwxr-xr-x - hdfs supergroup 0 2018-03-08 00:56 /user/mudassar/.snapshot/s20180308-005619.181
################################# # copy another file to the directory ################################# hdfs dfs -put /tmp/text2.txt /user/mudassar ################################# # Check the files exit in /user/mudassar notice the timestamp,permissions etc ################################# hdfs dfs -ls /user/mudassar output Found 2 items -rw-r--r-- 1 hdfs supergroup 58 2018-03-08 00:55 /user/mudassar/text1.txt -rw-r--r-- 1 hdfs supergroup 456 2018-03-08 00:58 /user/mudassar/text2.txt ################################# # Changed ownership of one of the files ################################# hdfs dfs -chown cloudera:supergroup /user/mudassar/text2.txt ################################# #Create second snapshot ################################# hdfs dfs -createSnapshot /user/mudassar ################################# # checked the directory notice now we have 2 snapshots one contains ONLY texte1.txt and the other contains both files
################################# $ hdfs dfs -ls /user/mudassar/.snapshot Output Found 2 items drwxr-xr-x - hdfs supergroup 0 2018-03-08 00:56 /user/mudassar/.snapshot/s20180308-005619.181 drwxr-xr-x - hdfs supergroup 0 2018-03-08 01:01 /user/mudassar/.snapshot/s20180308-010152.924
################################# # Simulate accidental deletion of the files ################################# hdfs dfs -rm /user/mudassar/* output 18/03/08 01:06:26 INFO fs.TrashPolicyDefault: Moved: 'hdfs://quickstart.cloudera:8020/user/mudassar/text1.txt' to trash at: hdfs://quickstart.cloudera:8020/user/hdfs/.Trash/Current/user/mudassar/text1.txt 18/03/08 01:06:26 INFO fs.TrashPolicyDefault: Moved: 'hdfs://quickstart.cloudera:8020/user/mudassar/text2.txt' to trash at: hdfs://quickstart.cloudera:8020/user/hdfs/.Trash/Current/user/mudassar/text2.txt ################################# # Validate the files were deleted ################################# hdfs dfs -ls /user/mudassar
Will return nothing but the directory exist, run hdfs dfs -ls /user/ ################################# # check the contents of the latest snapshot xxxxx.924 see above ################################# hdfs dfs -ls -R /user/mudassar/.snapshot/s20180308-010152.924 output -rw-r--r-- 1 hdfs supergroup 58 2018-03-08 00:55 /user/mudassar/.snapshot/s20180308-010152.924/text1.txt -rw-r--r-- 1 cloudera supergroup 456 2018-03-08 00:58 /user/mudassar/.snapshot/s20180308-010152.924/text2.txt ################################# # Recover the 2 files from snapshot using -ptopax option ################################# hdfs dfs -cp -ptopax /user/mudassar/.snapshot/s20180308-010152.924/* /user/mudassar/ ################################# # Validate the files were restored with original timestamps, ownership, permission, ACLs and XAttrs.
################################# hdfs dfs -ls /user/mudassar output -rw-r--r-- 1 hdfs supergroup 58 2018-03-08 00:55 /user/mudassar/text1.txt -rw-r--r-- 1 cloudera supergroup 456 2018-03-08 00:58 /user/mudassar/text2.txt There you are recovered the 2 files delete accidentally ,please let me know if that worked out for you
... View more
02-09-2016
07:28 PM
2 Kudos
1. To add on to Artem's idea. Disable IPv6 Temporarily
'echo 1 > /proc/sys/net/ipv6/conf/<interface-name>/disable_ipv6' eg 'echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' Disable IPv6 Permanently across reboots Edit the /etc/sysctl.conf and the following lines.
# to disable IPv6 on all interfaces system wide
net.ipv6.conf.all.disable_ipv6 = 1 # to disable IPv6 on a specific interface (e.g., eth0, lo) net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.eth0.disable_ipv6 = 1 2. Check the NTP server configuration or just restart NTP on both servers
... View more
- « Previous
- Next »