In your first example you can only use the first sentence with the present perfect progressive verb form "has been raining" because you are speaking about something that began in the past, and has continued to the present.
The present tense "It is raining" says only that it is raining right now, and is not appropriately used in sentence #2. Saying something has been happening "all day" is referring to a continuous action that began in the past, rather than only in the present.
In the second example, you would generally use "was raining". You would only want to use "had been raining yesterday", if you were going to follow up with something else, for example:
"It had been raining all day yesterday, when my friend asked me why I looked so gloomy."
... or perhaps if you were responding to something else that had already been said.
Person A: Why didn't you take the dog out for a walk yesterday?
Person B: It had been raining all day yesterday. I didn't want to be outside.
But you would not use that form by itself to express to someone that it has been raining all day today, or was raining all day yesterday.