If you want to greet somebody in Russian in a formal way, you can say “Здравствуйте!” (“Zdravstvyite!”) to a sir or a madam. “Здравствуйте!” means “Hello!”. But “Hello!” also means “Привет!” “Privet!” which you can you use to begin a conversation or just to greet your friend or acquaintance. You literally wish a person health by saying that.
“Zdravstvyi!” literally means “Be healthy!”. “Zdravie” is “health”. When you say “Zdravstvyite!”, you literally use the imperative mood.
Related: